kamlekar/slim-scroll

Focus on first load

Closed this issue · 4 comments

When i use it on all of page (A wrapper for page, after body), without clicking on scrollable area, scrolling is impossible with arrow keys. Using $.focus had no effect. How can i fix it?

This is where i'm using the plugin: 3mcando.com

Hi,

Actually, this issue was not happening because of the plugin. It is the default nature of the HTML. Anyway, I added a new property "keepFocus" which is when made true, the container will get focus. which will solve your problem :).

For example:

scroll.useSlimScroll(Element, {
          'keepFocus': true
}

If the container get a unnecessary blue border remove it using the following css:

:focus{ outline: none; }

Thanks! 👍

But it don't worked for me. I tested some other elements and found that using $.focus() on a link works good. Anyway thanks :)

try setting "tabindex=-1" to scrollable area and then apply $("selector").focus()