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

getFocusable should focus first element if initFocus is undefined #356

Open
sebnitu opened this issue Aug 27, 2020 · 0 comments
Open

getFocusable should focus first element if initFocus is undefined #356

sebnitu opened this issue Aug 27, 2020 · 0 comments

Comments

@sebnitu
Copy link
Owner

sebnitu commented Aug 27, 2020

Problem

Because of how the getFocusable() tests focusable elements, if an initial focus element is not returned, the element this method is called on will keep focus on the last element tested. This also causes the scroll reset to not work.

Possible Solution

  • If no initFocus element was returned, focus the first element after all element testing is finished.
  • Reverse the focusable elements array so that the last tested element would be the first focusable element in the target.
  • Add el.blur() after the element passes and is added to the array.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant