-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Focus element that has been scrolled to #67
Comments
Very good call in my opinion but should this be a different script, i.e. not part of smooth-scroll but triggered at the same time? |
👍 Accessibility measures like this are very important. At the very least, I should include this feature in the demos. Still, implementing a focus feature in the plugin itself could be problematic. Not all fragment identifiers ( #foo ) point to a focusable element, and it might not be what the plugin user would want to focus anyway. One way to achieve this "out of the box" is to use the $('a').smoothScroll({
afterScroll: function(opts) {
$(opts.scrollTarget).focus();
}
}); If we were to add a I'm inclined to leave the plugin as is and document the callback scenario, but I'm interested in hearing your thoughts. Also, let me know if I've missed anything. Thanks for bringing this to my attention. |
Your proposed solution is sort of what I ended up doing, only I had to find an element that wanted to be focussed. Somehow my |
Updated docs. |
A very interesting article about this matter https://css-tricks.com/smooth-scrolling-accessibility/ |
thanks @diegocanal ! I just published version 2.2.0 to include an |
This is an accessibility measure. Scrolling without focussing can cause issues when tabbing through links on a page. You smooth-scroll to an anchor way down on the page, but the focus stays on the very first element. Then you tab to the next thing expecting it to take you to the next visible link, but it whips you back up to the very first element.
The text was updated successfully, but these errors were encountered: