-
Notifications
You must be signed in to change notification settings - Fork 123
-
Notifications
You must be signed in to change notification settings - Fork 123
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
When window regains focus, focus-ring class should reapplied to the focused element #9
Comments
thanks for the issue. I think we may be able to fix this using the |
still working on this. It's a bit tricky as it seems that Anyway, still working on it, didn't want you to think we'd forgot :) |
Great, thanks for the update! FYI, for the time being we're trying this behavior as a mixin. The documentation page shows a live example of some buttons that use the mixin. A somewhat more realistic example can be see on the toolbar tabs demo for our Tabs element. In both cases, you should see a focus ring with the keyboard — including if you switch away from the window and restore focus to it. When the latter demo (https://elix.org/demos/toolbarTabs.html) is viewed on mobile, no focus ring is shown. |
I think the blur event happens on the window before it happens on the element. So, you could detect when the window is blurred, and whenever it is, save that in a variable and don't remove the |
@alice @robdodson should we close this issue since the fix has been merged? Or are you waiting to publish the fix to npm before closing? |
yep thanks for the PR! |
To repro:
.focus-ring
to it.Expect: Since the originally button still has focus, and the focus was obtained via the keyboard, the focus ring should be reapplied to it. This is what happens when focus-ring.js isn't used.
Actual: The focus ring is lost.
As a general rule, an element's focus ring is dropped if the window itself loses focus, but restored if/when the window regains focus. In the repro sequence above, a standard
button
(without using focus-ring.js) will end up showing a focus ring at the end of step #3.This useful behavior helps keyboard users reacquire the focused element when returning to a previously-used window.
The text was updated successfully, but these errors were encountered: