Skip to content

Commit df17859

Browse files
committed
aria-labelledby
1 parent c1821c0 commit df17859

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

components/dashboard/src/components/Modal.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ export default function Modal(props: {
7373
}
7474

7575
return (
76-
<div className="fixed top-0 left-0 bg-black bg-opacity-70 z-50 w-screen h-screen">
76+
<div
77+
className="fixed top-0 left-0 bg-black bg-opacity-70 z-50 w-screen h-screen"
78+
aria-labelledby="modal-title"
79+
role="alertdialog"
80+
>
7781
<div className="w-screen h-screen align-middle" style={{ display: "table-cell" }}>
7882
<div
7983
className={cn(
@@ -84,6 +88,7 @@ export default function Modal(props: {
8488
{props.closeable !== false && (
8589
<button
8690
className="absolute right-7 top-6 cursor-pointer text-gray-800 bg-transparent dark:text-gray-100 hover:bg-gray-200 dark:hover:bg-gray-700 rounded-md p-2"
91+
aria-label="Close this modal"
8792
onKeyDown={(e) => {
8893
// Prevent the modal from submitting when attempting to close it
8994
if (e.key === "Enter" || e.key === "Space") {
@@ -119,7 +124,11 @@ type ModalHeaderProps = {
119124
};
120125

121126
export const ModalHeader = ({ children }: ModalHeaderProps) => {
122-
return <h3 className="pb-2">{children}</h3>;
127+
return (
128+
<h3 className="pb-2" id="modal-title">
129+
{children}
130+
</h3>
131+
);
123132
};
124133

125134
type ModalBodyProps = {

0 commit comments

Comments
 (0)