<a-modal>開啟頁面報錯Ancestor with aria-hidden

SangFall發表於2024-11-15
報錯資訊

Blocked aria-hidden on an element because its descendant retained focus. The 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.
Element with focus: div
Ancestor with aria-hidden: <div tabindex=​"0" aria-hidden=​"true" style=​"width:​ 0px;​ height:​ 0px;​ overflow:​ hidden;​">​​

解決方法

全域性樣式

<style>
.ant-modal-root div[aria-hidden="true"] {
  display: none !important;
}
</style>

相關文章