question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Browser jumping to slider on afterChange, unwanted focus event when using slickGoTo

See original GitHub issue

I 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:open
  • Created 6 years ago
  • Reactions:14
  • Comments:12 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
walt-ercommented, Aug 11, 2017

Having poked around the source a bit, it seems to me that a couple lines should check for the focusOnSelect and focusOnChange 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).

2reactions
kenwheelercommented, Sep 18, 2017

Yup let me check with greggo on the status On Mon, Sep 18, 2017 at 4:00 PM Walter Mitchell notifications@github.com wrote:

@kenwheeler https://github.com/kenwheeler 👋 Any chance of updating the npm package? We’ll be forever grateful!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kenwheeler/slick/issues/3046#issuecomment-330339090, or mute the thread https://github.com/notifications/unsubscribe-auth/AARfmFfmLomr7TU8Sw4O70fvGYFkP1Xuks5sjsv5gaJpZM4Oz6rm .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Slick Slider slickGoTo method breaking the carousel
I'm using slick slider for the thumbnails on the gallery. Every image in the gallery has it's own url for ad view purposes...
Read more >
accessible-slick - the last (accessible) carousel you'll ever need
A highly accessible, WCAG 2.0 / 2.1 compliant, drop-in replacement for Slick Slider (1.8.1) crafted and tested by expert users and professional ...
Read more >
https://d3n8a8pro7vhmx.cloudfront.net/themes/57dc7...
removeClass( "ui-state-focus" ); } }); }, _trigger: function( type, event, ... browsers only repeat keydown events, not keypress events, // so we use...
Read more >
WNvYZMd - CodePen Embed
On the other hand, just using `getAttribute` is not enough as // the `nonce` attribute is ... is called // after the browser...
Read more >
Carousel. js file - Buono Antonio
Unless autoplay: true, sets browser focus to current slide (or first of current ... console.log(nextSlide); }); Event Params Description afterChange event, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found