feat: use role attribute instead of using class with no style

This commit is contained in:
Fernando Zanutto 2024-04-23 15:47:10 -03:00
parent 9fa88255a8
commit 801abbf744

View File

@ -40,7 +40,7 @@ export function Modal({
}; };
const isTopMostModal = () => { const isTopMostModal = () => {
const openModals = document.getElementsByClassName("modal-container"); const openModals = document.querySelectorAll("[role=modal-container]");
return ( return (
openModals.length && openModals.length &&
openModals[openModals.length - 1].id === "modal-container-" + componentId openModals[openModals.length - 1].id === "modal-container-" + componentId
@ -85,7 +85,8 @@ export function Modal({
return createPortal( return createPortal(
<div <div
className={styles.backdrop({ closing: isClosing }) + " modal-container"} className={styles.backdrop({ closing: isClosing })}
role="modal-container"
id={"modal-container-" + componentId} id={"modal-container-" + componentId}
> >
<div <div