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

Add ability to jump to first/last focusable. #149

Open
duhrer opened this issue Jan 23, 2024 · 0 comments
Open

Add ability to jump to first/last focusable. #149

duhrer opened this issue Jan 23, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@duhrer
Copy link
Contributor

duhrer commented Jan 23, 2024

I had hoped that refreshing would be an easy way to get back to the top of the page. Turns out, Chrome is very nice and preserves focus on reload and now it appears also on history navigation.

We may address this in #124, but I can also see the usefulness of having something like the "home" and "end" keys on the keyboard that jumps to the beginning/end of the document. One approach would be to focus on the first/last focusable element and let the scrolling handle itself. However, this would require careful naming, as it won't necessarily scroll all the way to the top or down to the bottom.

Another idea is to scroll and then set the current tabbable elements index to something out of bounds. For example, setting it to -1 would jump to the first element on the page when the right bumper is hit, and jump to the last element if the left bumper is hit.

For scrolling down, we'd set the value to the number of tabbables, and let our internal wrapping ensure that the right bumper would "wrap" to the top, and the left bumper would navigate to the last element on the page.

@duhrer duhrer added the enhancement New feature or request label Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant