-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Elements in Accordion Content loose focus #236
Comments
Minor update on this. I figured out the lines which result in the accordion trigger being focused instead of the proper accordion content element:
If all of these lines are commented out, then the bug is fixed ':). Obviously thats not the way we can ultimately solve this issue... |
I took another look at this and think I understand it better now. The source of this problem is, that the accordion is based on the concept, that the triggers (button) are the managed selection items, instead of the accordion items themselves. Afaik the selection manager seems to know nothing about the accordion items. It only knows about the triggers. createSelectableItem in accordion trigger:
no createSelectableItem in accordion item: And because of this, the selection manager has neither a way to know that the accordion item is already focused, nor a method to focus it. Instead it will try to find the first selectable key, which only can be a trigger:
Summary: I could not find a way to fix this bug, without changing the fundamental concept of the accordion 🙈. |
Try this workaround... function stopPropagation(e) {
e.stopPropagation();
};
<Accordion.Content
onKeyDown={stopPropagation}
onClick={stopPropagation}
onPointerDown={stopPropagation}
onMouseDown={stopPropagation}
onFocusIn={stopPropagation}> |
fixed by #483 |
Describe the bug
When the initial focus is not already in the accordion content, clicking on a child element of accordion content (e.g. an input) will focus it, but then instantly will focus the accordion trigger instead.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
When focusing elements in the accordion content, the focus should not be moved to the accordion trigger.
Screenshots
Bildschirmaufzeichnung.vom.2023-07-06.11-28-53.mp4
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: