Studio: Solve accessibility warning on user settings - #1418
Studio: Solve accessibility warning on user settings #1418katinthehatsite wants to merge 2 commits into
Conversation
epeicher
left a comment
There was a problem hiding this comment.
Thanks for working on this!
I have tested this and I have received the warning, I have double checked I was in this branch. Then I have moved to trunk, trying again and not getting the warning, then moved again to this branch and not getting the warning anymore 🤷 .
Sorry for not being very helpful 🙏 , but as mentioned in the issue, it seems that is not very consistent. Let me know if I can help more with this 😄
This is a screenshot of the first time I tried in this branch

|
Let me take a look 🫠 Thanks for checking! |
|
@epeicher I discovered that the issue is a bit bigger than this so I am going to close this for now I open a different PR. |
|
@ivan-ottinger It comes from the wordpress/components |

Related issues
Fixes: STU-504
Proposed Changes
When the
Popover (dropdown menu)forDelete all preview sitesis closed/hidden, it has aria-hidden="true" (set by WordPress components) applied to prevent screen readers from accessing its contents. However, theMenuItemstill has focusable attributes (aria-disabled) even when hidden. I believe this creates a conflict because an element marked as aria-hidden="true" should not contain any focusable descendants.Solution:
I propose to use the
DropdownMenu'sisOpen state to only apply focusable attributes when the menu is visible, and remove them when it's hidden. This ensures there are no focusable elements inside the Popover when it's hidden with aria-hidden="true".This maintains proper accessibility by:
Sidenote: Another solution that I tried as to render the menu in the root and outside of the DOM structure by using
__unstableSlotName: 'root'prop but I don't think it is a good solution to do this. Happy to discuss other alternatives as well.Testing Instructions
npm startUser Settingsin the top right cornerUsagetabPreview sitesDelete all preview sites, there is no warning in the dev toolsUser Settingsa couple of times to confirm it works (as in the issue originally, it is not something that I could always reproduce consistently)Pre-merge Checklist