-
Notifications
You must be signed in to change notification settings - Fork 61
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
Button: Cannot set focus method in Firefox #1618
Comments
gds-button
: cannot set focus on gds-button using HTMLElement focus method in Firefox
gds-button
: cannot set focus on gds-button using HTMLElement focus method in Firefox
Does it work if you set It seems like Firefox will not honor the |
@splashdust Thx for looking into this. I will try with |
@splashdust tried setting attribute |
We also noticed some tab order helper tools ignore button focus - like Silktide. But it helps setting tabindex="0". |
I don't know why it wouldn't work with the CDK Trap Focus Directive though. I checked the source code in their repo, and it does seem like it's looking for |
@splashdust I got back to this now since it was time to add a button in my UI again :-) I verified that it works in Firefox now (running 132.0.2 on Windows) with |
@E-landstrom Good to know! No decision yet, need to investigate a bit more to make sure there are no other unintended side-effects. I'll leave this issue open in the meantime. |
@splashdust ok! From my perspective it has only been an issue when I need to programmatically set focus on buttons (or using the CDK trap focus) when going into / leaving a modal. But it is really a gotcha :-) |
gds-button
: cannot set focus on gds-button using HTMLElement focus method in FirefoxBug already reported?
For which framework/library you are reporting the bug
Angular
Component name
gds-button
Description
It does not work to set focus on a
gds-button
in Firefox using the HTMLElement focus method. It works in Chrome, Edge and Safari. One use case is to set focus on a modal close button for an example upon entering a modal. Also when using the Angular CDK Trap Focus Directive it is not recognized as the first focusable element.Steps To Reproduce
setTimeout(() => {document.querySelector('gds-button').focus()}, 3000);
(remember to click in the story book page after setting the timeout).Current Behaviour
The button is not focused / recognized as a focusable element.
Expected Behaviour
The button should receive focus and be recognized as a focusable element.
The text was updated successfully, but these errors were encountered: