Skip to content

Commit

Permalink
Austenem/Accessibility updates (#3648)
Browse files Browse the repository at this point in the history
* aria child roles

* aria and lang updates

* update search

* detail page updates

* update search menu

* update toggle

* update nested detail accordion

* add changelog

* clean up

* review updates
  • Loading branch information
austenem authored Jan 6, 2025
1 parent c174175 commit 6c6ee37
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-accessibility-updates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Resolve accessibility issues related to arias and interactive controls throughout the portal.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ export default function CollapsibleDetailPageSection({
<StyledInfoIcon color="primary" />
</SecondaryBackgroundTooltip>
)}
</AccordionSummary>
<AccordionDetails sx={{ padding: 0 }}>
{action && (
<Box
onClick={(e) => {
Expand All @@ -72,12 +74,13 @@ export default function CollapsibleDetailPageSection({
}}
ml="auto"
className="accordion-section-action"
sx={{ position: 'absolute', right: 0, top: 7 }}
>
{action}
</Box>
)}
</AccordionSummary>
<AccordionDetails sx={{ padding: 0 }}>{children}</AccordionDetails>
{children}
</AccordionDetails>
</DetailPageSectionAccordion>
</DetailPageSection>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import withShouldDisplay from 'js/helpers/withShouldDisplay';
import { sectionIconMap } from 'js/shared-styles/icons/sectionIconMap';
import { SectionDescription } from 'js/shared-styles/sections/SectionDescription';
import { getTableEntities } from 'js/components/detailPage/MetadataSection/utils';
import { DownloadIcon, StyledWhiteBackgroundIconButton } from '../MetadataTable/style';
import { WhiteBackgroundIconButton } from 'js/shared-styles/buttons';
import { DownloadIcon } from '../MetadataTable/style';
import MetadataTabs from '../multi-assay/MultiAssayMetadataTabs';
import { Columns, defaultTSVColumns } from './columns';

Expand Down Expand Up @@ -54,12 +55,12 @@ function MetadataWrapper({ allTableRows, tsvColumns = defaultTSVColumns, childre
action={
<SecondaryBackgroundTooltip title="Download">
<a href={downloadUrl} download={`${hubmap_id}.tsv`}>
<StyledWhiteBackgroundIconButton
<WhiteBackgroundIconButton
aria-label="Download TSV of selected items' metadata"
onClick={() => trackEntityPageEvent({ action: `Metadata / Download Metadata` })}
>
<DownloadIcon color="primary" />
</StyledWhiteBackgroundIconButton>
</WhiteBackgroundIconButton>
</a>
</SecondaryBackgroundTooltip>
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { styled } from '@mui/material/styles';
import GetAppIcon from '@mui/icons-material/GetAppRounded';

import { WhiteBackgroundIconButton } from 'js/shared-styles/buttons';
import SectionHeader from 'js/shared-styles/sections/SectionHeader';

const DownloadIcon = styled(GetAppIcon)({
Expand All @@ -13,12 +11,8 @@ const Flex = styled('div')({
justifyContent: 'space-between',
});

const StyledWhiteBackgroundIconButton = styled(WhiteBackgroundIconButton)(({ theme }) => ({
marginBottom: theme.spacing(0.5),
}));

const StyledSectionHeader = styled(SectionHeader)({
alignSelf: 'flex-end',
});

export { DownloadIcon, Flex, StyledWhiteBackgroundIconButton, StyledSectionHeader };
export { DownloadIcon, Flex, StyledSectionHeader };
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const StatusIcon = forwardRef(function StatusIcon(

if (tooltip) {
return (
<SecondaryBackgroundTooltip title={irregularCaseStatus}>
<SecondaryBackgroundTooltip title={irregularCaseStatus} role="status">
{/* The wrapper is required for the tooltip to work */}
<Box display="flex">{content}</Box>
</SecondaryBackgroundTooltip>
Expand Down
2 changes: 1 addition & 1 deletion context/app/static/js/components/home/Hero/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const heroTabs = [
export default function Hero() {
const [activeTab, setActiveTab] = useState(0);
return (
<Paper component="section" role="tablist" aria-label="HuBMAP Introduction">
<Paper component="section" aria-label="HuBMAP Introduction">
<HeroTabContextProvider activeTab={activeTab} setActiveTab={setActiveTab}>
<HeroGridContainer $activeSlide={activeTab} role="tablist">
{heroTabs.map((tab, index) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import MenuItem from '@mui/material/MenuItem';
import FormControl from '@mui/material/FormControl';
import Select, { SelectChangeEvent } from '@mui/material/Select';
import ListItemIcon from '@mui/material/ListItemIcon';
import InputLabel from '@mui/material/InputLabel';
import Check from '@mui/icons-material/Check';

import { Entity } from 'js/components/types';
Expand All @@ -14,6 +15,7 @@ import { capitalizeString } from 'js/helpers/functions';
import TileGrid from 'js/shared-styles/tiles/TileGrid';
import { useEntityTileAriaLabelText } from 'js/hooks/useEntityTileAriaLabel';
import { trackEvent } from 'js/helpers/trackers';
import { StyledDownIcon } from 'js/shared-styles/dropdowns/DropdownMenuButton/style';
import { useSearch } from '../Search';
import ViewMoreResults from './ViewMoreResults';
import { useSearchStore } from '../store';
Expand Down Expand Up @@ -45,10 +47,16 @@ function TilesSortSelect() {

return (
<FormControl>
<InputLabel id="sort-select-label" sx={{ display: 'none' }}>
Sort by
</InputLabel>
<Select
value={sortField.field}
onChange={handleChange}
labelId="sort-select-label"
color="primary"
variant="outlined"
IconComponent={StyledDownIcon}
sx={(theme) => ({
backgroundColor: theme.palette.primary.main,
color: theme.palette.white.main,
Expand Down
2 changes: 1 addition & 1 deletion context/app/static/js/components/search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function Bar({ type }: TypeProps) {
return (
<Stack direction="row" spacing={1}>
<Box flexGrow={1}>
<SearchBar />
<SearchBar type={type} />
</Box>
<MetadataMenu type={type} />
<WorkspacesDropdownMenu type={type} />
Expand Down
3 changes: 2 additions & 1 deletion context/app/static/js/components/search/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { trackSiteSearch, trackEvent } from 'js/helpers/trackers';
import SearchBarComponent from 'js/shared-styles/inputs/SearchBar';
import { useSearchStore } from './store';

function SearchBar() {
function SearchBar({ type }: { type: string }) {
const { setSearch, search, analyticsCategory } = useSearchStore(
useShallow((state) => ({
setSearch: state.setSearch,
Expand Down Expand Up @@ -41,6 +41,7 @@ function SearchBar() {
<SearchBarComponent
id="free-text-search"
fullWidth
placeholder={`Search ${type.toLowerCase()}s`}
value={input}
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
setInput(event.target.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ function WorkspaceListItem({
<SecondaryBackgroundTooltip title={tooltipToDisplay}>
<span>
<ToggleComponent
aria-label={`Select ${workspace.name}.`}
inputProps={{
'aria-label': `Select ${workspace.name}.`,
}}
checked={selected}
onChange={() => toggleItem(workspace.id)}
disabled={isRunning || disabled}
Expand Down
7 changes: 4 additions & 3 deletions context/app/static/js/shared-styles/buttons/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PropsWithChildren, ComponentProps } from 'react';
import React, { PropsWithChildren, ComponentProps, useId } from 'react';
import { Theme, styled } from '@mui/material/styles';
import IconButton, { IconButtonProps } from '@mui/material/IconButton';
import ToggleButton from '@mui/material/ToggleButton';
Expand Down Expand Up @@ -66,10 +66,11 @@ function TooltipToggleButton({
...rest
}: TooltipToggleButtonProps) {
const Tooltip = tooltipComponent;
const tooltipId = useId();

return (
<Tooltip title={tooltipTitle}>
<span>
<Tooltip title={tooltipTitle} id={tooltipId}>
<span aria-describedby={tooltipId}>
<WhiteBackgroundToggleButton {...rest} id={id} data-testid={id}>
{children}
</WhiteBackgroundToggleButton>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { styled } from '@mui/material/styles';
import { Theme, styled } from '@mui/material/styles';
import { UpIcon, DownIcon } from 'js/shared-styles/icons';

const StyledUpIcon = styled(UpIcon)(({ theme }) => ({
const sharedIconStyles = ({ theme }: { theme: Theme }) => ({
marginLeft: theme.spacing(0.5),
}));
fontSize: '1.5rem',
});

const StyledDownIcon = styled(DownIcon)(({ theme }) => ({
marginLeft: theme.spacing(0.5),
}));
const StyledUpIcon = styled(UpIcon)(sharedIconStyles);
const StyledDownIcon = styled(DownIcon)(sharedIconStyles);

export { StyledUpIcon, StyledDownIcon };
2 changes: 1 addition & 1 deletion context/app/static/js/shared-styles/icons/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import EditRoundedIcon from '@mui/icons-material/EditRounded';
import CollectionsBookmarkRoundedIcon from '@mui/icons-material/CollectionsBookmarkRounded';
import EmailRoundedIcon from '@mui/icons-material/EmailRounded';
import ListAltRoundedIcon from '@mui/icons-material/ListAltRounded';
import ArrowDropDownRoundedIcon from '@mui/icons-material/ExpandMoreRounded';
import ArrowDropDownRoundedIcon from '@mui/icons-material/ArrowDropDownRounded';
import ArrowDropUpRoundedIcon from '@mui/icons-material/ArrowDropUpRounded';
import AddRoundedIcon from '@mui/icons-material/AddRounded';
import DescriptionRoundedIcon from '@mui/icons-material/DescriptionRounded';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function InfoTextTooltip({ tooltipTitle, children }: InfoTextTooltipProps) {
return (
<StyledOuterStack>
{children}
<SecondaryBackgroundTooltip title={tooltipTitle}>
<SecondaryBackgroundTooltip title={tooltipTitle} role="definition">
<StyledInnerStack>
<StyledInfoIcon />
</StyledInnerStack>
Expand Down

0 comments on commit 6c6ee37

Please sign in to comment.