Skip to content

Commit

Permalink
Fix some accessibility issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
fniessink committed Jan 25, 2025
1 parent 7473b17 commit ed39c3d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 24 deletions.
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

0 comments on commit ed39c3d

Please sign in to comment.