MUI v6对话框首次关闭时触发aria-hidden无障碍警告问题求助
我目前在用Material-UI (MUI) v6开发一个点击按钮即可唤起的对话框,碰到了一个奇怪的无障碍警告问题:仅在组件首次渲染/挂载完成后,第一次关闭对话框时会弹出这个警告,后续反复打开、关闭对话框都不会再触发。
这个问题出现在包含触发按钮的组件上,而且我自己的代码里完全没有手动使用过aria-hidden属性,所以我推测这个属性是MUI内部实现自动添加的。
控制台显示的警告内容如下:
Blocked aria-hidden on a
<div>element because the element that just received focus must not be hidden from assistive technology users.
Avoid using aria-hidden on a focused element or its ancestor.
Consider using the inert attribute instead, which will also prevent focus. For more details, see the aria-hidden section of the WAI-ARIA specification at https://w3c.github.io/aria/#aria-hidden.
原本还有在线示例的链接,但内容被截断了没法完整展示。
有没有大佬遇到过类似的情况?麻烦帮忙分析下问题原因,或者给个解决思路呀!
备注:内容来源于stack exchange,提问作者CrackerKSR
相关产品推荐
相关产品推荐

