Browser jumping to slider on afterChange, unwanted focus event when using slickGoTo
See original GitHub issueI have some buttons unaffiliated with my slick slider that activate the slider using slickGoTo
. Once the slider has animated to that slide – right when the “afterChange” event fires – the browser scrolls to the top of the slider. Some testing has shown that the slides are focused when moved to programmatically.
I can’t find a way to prevent this focus from occurring. I’ve tried messing with the slides’ tabindex
attr but slick seems to reset that attr when animating to a slide. I need to avoid focus as it jumps uncomfortably when the slider is only partially on screen.
I also am unable to modify slick’s own files to make a fix; I need to fix this in my own code. I am using the slick NPM module and I’m seeing the problem on Chrome and Safari with macOS Sierra.
It seems to be exactly what was described in this now-closed ticket: https://github.com/kenwheeler/slick/issues/1662
And here’s a gif from that thread demonstrating the issue, albeit using slick arrows and not slickGoTo
: https://i.gyazo.com/12167ed07ed2b1f45338059dbcb5ba0c.gif
Thanks in advance!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:14
- Comments:12 (1 by maintainers)
Top GitHub Comments
Having poked around the source a bit, it seems to me that a couple lines should check for the
focusOnSelect
andfocusOnChange
options before triggering focus:https://github.com/kenwheeler/slick/blob/8ccd846dd2f63963ed4388c1963c77dc2869c482/slick/slick.js#L723 https://github.com/kenwheeler/slick/blob/8ccd846dd2f63963ed4388c1963c77dc2869c482/slick/slick.js#L1703
Also, for anyone else experiencing this issue, I figured out that turning off the
accessibility
option is a temporary workaround for this bug (although this also disables tabbing and arrow keys).Yup let me check with greggo on the status On Mon, Sep 18, 2017 at 4:00 PM Walter Mitchell notifications@github.com wrote: