-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Options in the CircularOptionPicker may be not operable with the keyboard #65283
Comments
Note: seems to me this isn't specific to the presence of the button of the 'Color randomizer' experiment. Rather, it appers to be something related to re-rendering of the color picker buttons which may happen in other scenarios as well. As such, while this issue surfaced by testing an edge case, it appears to be a more general issue with generating the IDs and the logic to set the |
Thanks for the thorough instructions @afercia, I couldn't have made it without them! 🙌 I was able to reproduce it, although very inconsistently. I wonder if we can have a better way to reproduce, ideally in trunk. Without a clear, minimal reproduction case, it feels like a lower-priority edge case. |
Thanks for your feedback.
Yes, reproducing is inconsistent for me as well. Which makes me think it's a timing issue. |
@diegohaz , do you have an estimate of when ariakit/ariakit#4100 may be fixed? It will inform us on whether we should patch on our end, or wait for an ariakit fix. |
The fix likely includes a breaking change, so I wouldn't wait for it. |
After taking a look, I don't think this is the case. That code basically changes the initial active composite item in case an option is marked as selected. This allows the selected item to receive focus when the composite widget it focused. Instead, this is what I think is happening:
If my hypothesis is true, the fix would be to add code in |
I put together a quick code sandbox to demonstrate the issue described above. Note that, when the active composite item is removed from the react tree, the active id can become stale, causing Kapture.2024-09-19.at.11.54.23.mp4 |
I tested the solution proposed in the previous message in this other codesandbox, and it seems to work well: Kapture.2024-09-19.at.12.12.50.mp4The question is: where should this fix be? Adding this behaviour directly to Alternatively, we could add it to |
While we should probably work on a fix on our end, at least for the short term, I also opened an issue in Ariakit. |
I believe that the UI has changed, but in any case I'm testing a potential fix directly on the |
#65720 was merged. Feel free to re-open in case the issue was not solved. |
Description
Working on #65124 surfaced an edge case where the buttons in the color picker may end up in a state where they're not focusable because they all have a
tabindex="-1"
attribute.I'm not sure what is the root cause but I see some recent work on the
CircularOptionPicker
and the underlyingComposite
components in #64833It appears to me the UI may end up in a state where the value of the circular option picker option
activeId
value doesn't match any HTML id attribute in the UI. As such, none of the color buttons is considered 'active'. Worth reminding the 'actice' button is expected to be the only button that is focusable with the Tab key, while navigation to the other buttons works via arrow keys.Cc @WordPress/gutenberg-components
Three prerequisites to reproduce the bug:
Aniamted GIF to illustrate; Notice that after randomizing the colors, tabbing through the UI entirely skipcs the color picker buttons:
Step-by-step reproduction instructions
Inspecting the source:
tabindex="-1"
attribute.tabindex="0"
).activeId
may return a value that doesn't match any ID attribute in the DOM. for example:activeId
value iscomponents-circular-option-picker-3-75
.activeId
e.g.:Worth also noting that the ID values in the HTML are not consecutive. I would expect to be numbers progressively incremented by 1. Instead, they appear to be pretty inconsistent, which makes me think to some timing issue and the ID being genereated randomly across the multiple instances of the color picker.
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
The text was updated successfully, but these errors were encountered: