Element: thuộc tính ariaModal
Baseline
2023
Newly available
Since October 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Thuộc tính ariaModal của giao diện Element phản chiếu giá trị của thuộc tính aria-modal, cho biết liệu một phần tử có ở chế độ modal khi được hiển thị. Việc áp dụng thuộc tính aria-modal cho một phần tử có role="dialog" thay thế kỹ thuật sử dụng aria-hidden trên nền để thông báo cho công nghệ hỗ trợ rằng nội dung bên ngoài dialog không hoạt động.
Giá trị
Một chuỗi với một trong các giá trị sau:
Ví dụ
Trong ví dụ này, thuộc tính aria-modal trên phần tử có ID address-modal được đặt thành "true" cho biết đây là một dialog modal. Sử dụng ariaModal chúng ta cập nhật giá trị thành "false".
<div
role="dialog"
id="address-modal"
aria-labelledby="dialog1Title"
aria-describedby="dialog1Desc"
aria-modal="true"></div>
let el = document.getElementById("address-modal");
console.log(el.ariaModal); // "true"
el.ariaModal = "false";
console.log(el.ariaModal); // "false"
Đặc tả kỹ thuật
| Specification |
|---|
| Accessible Rich Internet Applications (WAI-ARIA)> # dom-ariamixin-ariamodal> |