6

I'm unable to add custom scroll due to the component/namespace encapsulation when locker service is activated in Salesforce1 app. Since the Scrollable is still not compatible with Salesforce1 app, and also because <ui:scrollerwrapper> cannot be used to add dynamic scroll functionality, I'm depending on an external custom scroll plugin.

Also, neither the lightning:textarea implements default scroll functionality when it exceeds the specified height, which was released in Winter '17 (Link to the issue).

So, I've used jQuery nicescroll plugin to implement niceScroll functionality inside the ui:inputTextArea. And to use it I'm accessing ui:inputTextArea by its aura id:- component.find("editModeScrollBarY").getElement() Since this is not in my namespace I'm getting an error:-

component.find(...).getElement is not a function

Here's the link to the unmanaged package to reproduce the issue when Locker Service is active:-

https://login.salesforce.com/packaging/installPackage.apexp?p0=04tB00000004p3m

Standard repro steps:

  1. Install the package.
  2. Activate Lightning Page from Lightning App Builder. (Lightning App Builder--> Edit "niceScroll_LS_Issue"--> Save--> Activation--> Lightning Experience--> Add Page to app--> Save )
  3. Open Sales app and click on "niceScroll_LS_Issue" tab (Try loading the page when Locker Service is activated and when Locker Service is deactivated).

I understand, that I'm accessing ui:inputTextArea which is outside the namespace, which is not allowed as per Locker Service as Doug has clearly answered here.

Can someone here help me on how to implement scroll functionality in this case?

  • Have you considered not using the ui:textarea but write your own textarea component? This will resolve the namespace issue, downside is you'll have to write your own textarea component. – Lieven Juwet Dec 6 '16 at 13:13
  • 1
    Hi @LievenJuwet Will it be a good idea to write a component just for this, as in spent time on that and finally there comes a situation where again Salesforce wouldn't provide support for the same? Wouldn't it be much better if Salesforce itself fixes the various scroll functionality LS issues currently prevailing even in various components which has been released in Winter '17 as I've clearly mentioned in the question?? – SE_User Dec 6 '16 at 13:26
  • Wondering if you use dynamic create components via $A.CreateComponent in that case may be you can access the element .Again I have not tried but something that might be worth trying . – Mohith Shrivastava Dec 6 '16 at 13:52
  • 3
    @SE_User it is indeed frustrating that bugs like this have to be logged as questions and pray that someone from Salesforce will do something about it. – Artur Dec 8 '16 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.