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

Fix some accessibility issues. #10723

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion components/frontend/src/header_footer/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function QuoteColumn() {

export function Footer({ lastUpdate, report }) {
return (
<AppBar position="relative" sx={{ displayPrint: "none" }}>
<AppBar component="footer" position="relative" sx={{ displayPrint: "none" }}>
<Container maxWidth="md" sx={{ padding: "60px" }}>
<Grid container spacing={2} columns={{ xs: 1, sm: 3 }}>
<Grid size={1}>
Expand Down
6 changes: 4 additions & 2 deletions components/frontend/src/widgets/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import { element, oneOfType, string } from "prop-types"
export function Header({ header, level, subheader }) {
return (
<Stack direction="column" sx={{ whiteSpace: "normal" }}>
<Typography variant={level}>{header}</Typography>
<Typography variant={`h${parseInt(level[1]) + 1}`}>{subheader}</Typography>
<Typography variant={level}>
{header}
{subheader && <Typography sx={{ fontSize: "80%", fontWeight: "inherit" }}>{subheader}</Typography>}
</Typography>
</Stack>
)
}
Expand Down
2 changes: 2 additions & 0 deletions components/frontend/src/widgets/HeaderWithDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export function HeaderWithDetails({ children, header, item_uuid, level, settings
expanded={showDetails}
onChange={() => settings.expandedItems.toggle(item_uuid)}
slotProps={{ transition: { unmountOnExit: true } }} // Make testing for (dis)appearance of contents easier
slots={{ heading: "div" }}
sx={{
"&:before": {
display: "none", // Remove top border
Expand All @@ -23,6 +24,7 @@ export function HeaderWithDetails({ children, header, item_uuid, level, settings
>
<AccordionSummary
aria-controls={showDetails ? `accordion-content-${item_uuid}` : null}
aria-label="Expand/collapse"
expandIcon={<CaretRight size={{ h1: "5em", h2: "4em", h3: "3em" }[level]} />}
id={`accordion-header-${item_uuid}`}
sx={{
Expand Down
29 changes: 8 additions & 21 deletions components/frontend/src/widgets/TableHeaderCell.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ButtonBase, TableCell, TableSortLabel, Tooltip } from "@mui/material"
import { TableCell, TableSortLabel, Tooltip } from "@mui/material"
import { func, string } from "prop-types"

import {
Expand Down Expand Up @@ -39,28 +39,15 @@ export function SortableTableHeaderCell({
help,
}) {
const sorted = sortColumn === column ? MuiSortDirection(sortDirection) : null
const align = textAlign || "left"
return (
<TableCell colSpan={colSpan} sortDirection={sorted}>
<ButtonBase
focusRipple
sx={{
display: "block",
fontSize: "inherit",
padding: "inherit",
textAlign: align,
width: "100%",
}}
tabIndex={-1}
<TableCell align={textAlign || "left"} colSpan={colSpan} sortDirection={sorted}>
<TableSortLabel
active={column === sortColumn}
direction={column === sortColumn ? MuiSortDirection(sortDirection) : "asc"}
onClick={() => handleSort(column)}
>
<TableSortLabel
active={column === sortColumn}
direction={column === sortColumn ? MuiSortDirection(sortDirection) : "asc"}
onClick={() => handleSort(column)}
>
{children || <TableHeaderCellContents help={help} label={label} />}
</TableSortLabel>
</ButtonBase>
{children || <TableHeaderCellContents help={help} label={label} />}
</TableSortLabel>
</TableCell>
)
}
Expand Down
Loading