Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Austenem/Accessibility updates #3648

Merged
merged 11 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 0 }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a creative workaround to the issue!

A minor nitpick:

  • the actions are very slightly misaligned relative to the accordion heading; could we adjust the top value accordingly?
    • Local:
      image
    • Prod:
      image

Behaviorally it matches, so this should be just a minor top adjustment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Should be aligned now:
Screenshot 2024-12-20 at 12 09 11 PM

>
{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 @@ -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 @@ -13,6 +14,7 @@ import { getTileDescendantCounts } from 'js/components/entity-tile/EntityTile/ut
import { capitalizeString } from 'js/helpers/functions';
import TileGrid from 'js/shared-styles/tiles/TileGrid';
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 @@ -44,10 +46,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 @@ -175,7 +175,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
2 changes: 1 addition & 1 deletion context/app/static/js/shared-styles/buttons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function TooltipToggleButton({

return (
<Tooltip title={tooltipTitle}>
<span>
<span role="tooltip">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the most appropriate role for the wrapper of the tooltip anchor, since the MDN example has the tooltip role on the div with the tooltip contents, rather than the anchor: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/tooltip_role

Maybe we could use useId to generate a unique tooltip ID, pass it to Tooltip as the id, and use the aria-describedby prop on the span or button instead?

<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
2 changes: 1 addition & 1 deletion context/app/templates/base-pages/base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html>
<html lang="en">

<head>
<meta charset="utf-8">
Expand Down
Loading