Skip to content

Commit

Permalink
fix(modal): use modal description as aria-described-by
Browse files Browse the repository at this point in the history
  • Loading branch information
stinachen committed Jul 31, 2023
1 parent 6559d6b commit bbcccc6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/modal/src/ModalContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { cx } from 'classix';
import { LazyMotion, m } from 'framer-motion';
import { useState, useEffect, useRef } from 'react';

import { MODAL_LABELLED_BY } from './constants';
import { MODAL_DESCRIBED_BY, MODAL_LABELLED_BY } from './constants';
import styles from './styles/Modal.module.css';
import { useMediaQuery } from './utils';

Expand Down Expand Up @@ -147,7 +147,7 @@ const ModalContainer = ({
variants={isDesktopViewport ? transitions.desktopPop : transitions.mobileSlideUp}
role="dialog"
aria-labelledby={MODAL_LABELLED_BY}
aria-describedby={MODAL_LABELLED_BY}
aria-describedby={MODAL_DESCRIBED_BY}
aria-modal
data-test-id={testId}
className={cx(styles.modal, styles[size], className)}
Expand Down
5 changes: 4 additions & 1 deletion packages/modal/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
export const MODAL_LABELLED_BY = 'modal-title';
const MODAL_LABELLED_BY = 'modal-title';
const MODAL_DESCRIBED_BY = 'modal-description';

export { MODAL_DESCRIBED_BY, MODAL_LABELLED_BY };

0 comments on commit bbcccc6

Please sign in to comment.