From 3a35d29c25b7e955d3857e9ff6aba81d71df735c Mon Sep 17 00:00:00 2001 From: Dickson Date: Mon, 14 Feb 2022 14:49:09 +0800 Subject: [PATCH] Make various buttons across the UI accessible for screen reader users There are 2 types of buttons: 1. Buttons with purely iconic labels 2. Buttons that have a label that displays on hover The tooltip component from rsuite doesn't implement the aria tooltip pattern, hence I added labels to the triggering control instead as a workaround --- src/components/card/Card.tsx | 6 +++ src/components/layout/Layout.tsx | 16 +++++-- src/components/library/ArtistView.tsx | 2 +- src/components/player/PlayerBar.tsx | 32 +++++++++++++ .../scrollingmenu/ScrollingMenu.tsx | 2 + src/components/search/SearchBar.tsx | 1 + .../selectionbar/SelectionButtons.tsx | 1 + src/components/shared/ToolbarButtons.tsx | 48 ++++++++++++------- 8 files changed, 86 insertions(+), 22 deletions(-) diff --git a/src/components/card/Card.tsx b/src/components/card/Card.tsx index 703fce3..5e9a05d 100644 --- a/src/components/card/Card.tsx +++ b/src/components/card/Card.tsx @@ -306,6 +306,7 @@ const Card = ({ handlePlayAppend('later')} size={size <= 160 ? 'xs' : 'sm'} icon={} @@ -314,6 +315,7 @@ const Card = ({ handlePlayAppend('next')} size={size <= 160 ? 'xs' : 'sm'} icon={} @@ -323,6 +325,9 @@ const Card = ({ {playClick.type !== 'playlist' && ( handleFavorite(rest.details)} size={size <= 160 ? 'xs' : 'sm'} icon={} @@ -332,6 +337,7 @@ const Card = ({ {!rest.isModal && !noModalButton && ( } onClick={handleOpenModal} diff --git a/src/components/layout/Layout.tsx b/src/components/layout/Layout.tsx index 790004a..3d50feb 100644 --- a/src/components/layout/Layout.tsx +++ b/src/components/layout/Layout.tsx @@ -145,10 +145,20 @@ const Layout = ({ footer, children, disableSidebar, font }: any) => { > - history.goBack()}> + history.goBack()} + > - history.goForward()}> + history.goForward()} + > @@ -200,7 +210,7 @@ const Layout = ({ footer, children, disableSidebar, font }: any) => { placement="bottomEnd" preventOverflow > - + diff --git a/src/components/library/ArtistView.tsx b/src/components/library/ArtistView.tsx index 99bff83..1f86eaf 100644 --- a/src/components/library/ArtistView.tsx +++ b/src/components/library/ArtistView.tsx @@ -738,7 +738,7 @@ const ArtistView = ({ ...rest }: any) => { } > - + diff --git a/src/components/player/PlayerBar.tsx b/src/components/player/PlayerBar.tsx index 5e26ab1..6eb5366 100644 --- a/src/components/player/PlayerBar.tsx +++ b/src/components/player/PlayerBar.tsx @@ -381,6 +381,7 @@ const PlayerBar = () => { style={{ cursor: 'pointer' }} /> { dispatch(setSidebar({ coverArt: true })); @@ -531,6 +532,8 @@ const PlayerBar = () => { {/* Seek Backward Button */} { {/* Previous Song Button */} { {/* Play/Pause Button */} { {/* Next Song Button */} { {/* Seek Forward Button */} { {/* Favorite Button */} { } > { {/* Shuffle Button */} { {/* Display Queue Button */} { @@ -75,6 +76,7 @@ const ScrollingMenu = ({ { diff --git a/src/components/search/SearchBar.tsx b/src/components/search/SearchBar.tsx index 58721cc..d3d06f7 100644 --- a/src/components/search/SearchBar.tsx +++ b/src/components/search/SearchBar.tsx @@ -709,6 +709,7 @@ const SearchBar = () => { > { setOpenSearch(true); setTimeout(() => { diff --git a/src/components/selectionbar/SelectionButtons.tsx b/src/components/selectionbar/SelectionButtons.tsx index 75f32b0..605f05b 100644 --- a/src/components/selectionbar/SelectionButtons.tsx +++ b/src/components/selectionbar/SelectionButtons.tsx @@ -11,6 +11,7 @@ const CustomIconButton = ({ tooltipText, icon, handleClick, ...rest }: any) => { {tooltipText ? ( } diff --git a/src/components/shared/ToolbarButtons.tsx b/src/components/shared/ToolbarButtons.tsx index 0e54640..864d9ad 100644 --- a/src/components/shared/ToolbarButtons.tsx +++ b/src/components/shared/ToolbarButtons.tsx @@ -7,7 +7,7 @@ import { StyledButton } from './styled'; export const PlayButton = ({ text, ...rest }: any) => { return ( - + @@ -17,7 +17,7 @@ export const PlayButton = ({ text, ...rest }: any) => { export const PlayAppendButton = ({ text, ...rest }: any) => { return ( - + @@ -27,7 +27,7 @@ export const PlayAppendButton = ({ text, ...rest }: any) => { export const PlayAppendNextButton = ({ text, ...rest }: any) => { return ( - + @@ -37,7 +37,7 @@ export const PlayAppendNextButton = ({ text, ...rest }: any) => { export const PlayShuffleAppendButton = ({ ...rest }) => { return ( - + @@ -47,7 +47,7 @@ export const PlayShuffleAppendButton = ({ ...rest }) => { export const SaveButton = ({ text, ...rest }: any) => { return ( - + @@ -57,7 +57,7 @@ export const SaveButton = ({ text, ...rest }: any) => { export const EditButton = ({ ...rest }) => { return ( - + @@ -67,7 +67,7 @@ export const EditButton = ({ ...rest }) => { export const UndoButton = ({ ...rest }) => { return ( - + @@ -77,7 +77,7 @@ export const UndoButton = ({ ...rest }) => { export const DeleteButton = ({ ...rest }) => { return ( - + @@ -87,7 +87,11 @@ export const DeleteButton = ({ ...rest }) => { export const FavoriteButton = ({ isFavorite, ...rest }: any) => { return ( - + @@ -101,7 +105,15 @@ export const DownloadButton = ({ downloadSize, ...rest }: any) => { downloadSize ? i18n.t('Download ({{downloadSize}})', { downloadSize }) : i18n.t('Download') } > - + @@ -111,7 +123,7 @@ export const DownloadButton = ({ downloadSize, ...rest }: any) => { export const ShuffleButton = ({ ...rest }) => { return ( - + @@ -121,7 +133,7 @@ export const ShuffleButton = ({ ...rest }) => { export const ClearQueueButton = ({ ...rest }) => { return ( - + @@ -158,7 +170,7 @@ export const FilterButton = ({ ...rest }) => { export const AutoPlaylistButton = ({ noText, ...rest }: any) => { return ( - + {!noText && i18n.t('Auto playlist')} @@ -169,7 +181,7 @@ export const AutoPlaylistButton = ({ noText, ...rest }: any) => { export const MoveUpButton = ({ ...rest }) => { return ( - + @@ -179,7 +191,7 @@ export const MoveUpButton = ({ ...rest }) => { export const MoveDownButton = ({ ...rest }) => { return ( - + @@ -189,7 +201,7 @@ export const MoveDownButton = ({ ...rest }) => { export const MoveTopButton = ({ ...rest }) => { return ( - + @@ -199,7 +211,7 @@ export const MoveTopButton = ({ ...rest }) => { export const MoveBottomButton = ({ ...rest }) => { return ( - + @@ -209,7 +221,7 @@ export const MoveBottomButton = ({ ...rest }) => { export const RemoveSelectedButton = ({ ...rest }) => { return ( - +