Skip to content

Commit

Permalink
add ARIA to confirmation, rider, and ride modals
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinWoo committed Nov 7, 2023
1 parent 741150f commit 3759019
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
10 changes: 8 additions & 2 deletions frontend/src/components/Modal/ConfirmationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,15 @@ const ConfirmationModal = ({
};

return (
<Modal title={''} isOpen={open} onClose={closeModal} displayClose={true} id="confirm-modal">
<Modal
title={''}
isOpen={open}
onClose={closeModal}
displayClose={true}
arialabelledby="confirm-text"
>
<div className={styles.modal}>
<p className={styles.modalText}>
<p className={styles.modalText} id="confirm-text">
Are you sure you want to remove {user.firstName} {user.lastName}?
</p>
<div className={styles.buttonContainer}>
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type ModalProps = {
displayClose?: boolean;
isRider?: boolean;
id?: string;
arialabelledby?: string;
};

const Modal = ({
Expand All @@ -47,7 +48,8 @@ const Modal = ({
onClose,
displayClose,
isRider = true,
id,
arialabelledby,
id = 'modal',
}: ModalProps) => {
// Wrapping children in Array to match type for numPages
const pages = paginate ? (children as React.ReactNodeArray) : [children];
Expand Down Expand Up @@ -75,7 +77,7 @@ const Modal = ({
className={styles.modal}
role="dialog"
aria-modal="true"
aria-labelledby={id}
aria-labelledby={arialabelledby ?? id}
>
<div className={styles.topContainer}>
{isRider ? (
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/Modal/RiderModalInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ const RiderModalInfo = ({
Needs:{' '}
</Label>
<select
id="needs"
name="needs"
aria-required="true"
ref={register({ required: true })}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/RideModal/RideModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ const RideModal = ({ open, close, ride, editSingle }: RideModalProps) => {
isOpen={isOpen}
currentPage={currentPage}
onClose={closeModal}
id="ride-modal"
>
<RideTimesPage
formData={formData}
Expand Down

0 comments on commit 3759019

Please sign in to comment.