Skip to content
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

Tab order of items not updated when sorted #175

Open
rifkegribenes opened this issue Sep 16, 2017 · 2 comments
Open

Tab order of items not updated when sorted #175

rifkegribenes opened this issue Sep 16, 2017 · 2 comments

Comments

@rifkegribenes
Copy link

Shuffle version

5.0.1

Reproduction Link

http://co-ment.glitch.me/posts

Steps to reproduce

Shuffled items tab order still reflects DOM order even when sorted by different criteria. Click Sort by Popular, then try to tab through grid

What is Expected?

Tab order should reflect current sort order

What is actually happening?

Tab order still reflects DOM order instead of sort order

@Vestride
Copy link
Owner

Is there a good way to handle this without setting a tab index on each tab-able element? I don't want to use the tab index attribute because that would conflict with a site's tab order.

Another way to accomplish this would be to rearrange the DOM elements within the container (likely create a DocumentFragment, appending each element to it, then appending that to the container). I'm worried about the performance of this though. It would also probably warrant a major version bump.

Any suggestions?

@rifkegribenes
Copy link
Author

i ended up using this library to solve the issue in my project: https://github.com/redbubble/responsive-tab-order. it does require that you set a data-tabindex attribute on every focusable element on the page, and then it sets the order dynamically (you can trigger a reset on window resize, on scroll, or whatever is necessary, i set it up to reorder tabs on shuffle).

in order to get it to work i also had to add the data-tabindex attribute to my header and footer elements, and then remove them when navigating away from the page where i'm using shuffle.

it would be cool to have something like this integrated into shuffle for optional use. obviously not everybody uses this for interactive elements (a simple image gallery with no links would not need it). but if there are any focusable elements in the shuffle then it's kind of a mess for keyboard-only users.

or if it's not integrated, then maybe add a note in the docs about accessibility to alert developers that if you use this library you're going to have to work out your own solution to make it WCAG compliant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants