Skip to content

Commit

Permalink
fix(a11y): aria labels and semantic html (#1798)
Browse files Browse the repository at this point in the history
* fix(a11y): aria labels and semantic html

* fix(a11y): correct voiceover on icons
  • Loading branch information
purusott authored Jan 23, 2025
1 parent 4ce26cd commit f8a40c0
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 15 deletions.
12 changes: 6 additions & 6 deletions tavla/app/(admin)/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ function Footer() {
return (
<footer className="eds-contrast">
<div className="container pt-16 pb-4">
<Image src={TavlaLogo} alt="" />
<Image src={TavlaLogo} alt="Entur Tavla logo" />
<div className="flex flex-col sm:flex-row justify-between">
<div>
<Heading3>Entur AS</Heading3>
<Heading3 as="h2">Entur AS</Heading3>
<Paragraph className=" items-center">
Rådhusgata 5, 0151 Oslo
<br />
<br aria-hidden />
Postboks 1554, 0117 Oslo
</Paragraph>
<Paragraph className="items-center">
Organisasjonsnummer:
<br />
<br aria-hidden />
917 422 575
</Paragraph>
<Paragraph
Expand All @@ -32,7 +32,7 @@ function Footer() {
<EnturLink href="https://www.entur.org/kontakt-oss/">
Kontakt kundesenteret
</EnturLink>
<ExternalIcon className="!top-0" />
<ExternalIcon aria-hidden className="!top-0" />
</Paragraph>
<Paragraph className="items-center flex flex-row gap-1">
<EnturLink
Expand All @@ -46,7 +46,7 @@ function Footer() {
>
Kontakt Tavla
</EnturLink>
<ExternalIcon className="!top-0" />
<ExternalIcon aria-hidden className="!top-0" />
</Paragraph>
</div>
<div className="flex flex-col gap-4">
Expand Down
6 changes: 3 additions & 3 deletions tavla/app/(admin)/components/TileSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function TileSelector({
items={counties}
selectedItems={selectedCounties}
onChange={setSelectedCounties}
prepend={<SearchIcon />}
prepend={<SearchIcon aria-hidden />}
maxChips={2}
hideSelectAll
/>
Expand All @@ -77,7 +77,7 @@ function TileSelector({
items={stopPlaceItems}
label="Stoppested"
clearable
prepend={<SearchIcon />}
prepend={<SearchIcon aria-hidden />}
selectedItem={selectedStopPlace}
onChange={setSelectedStopPlace}
debounceTimeout={150}
Expand All @@ -90,7 +90,7 @@ function TileSelector({
items={quays}
label="Plattform/retning"
clearable
prepend={<SearchIcon />}
prepend={<SearchIcon aria-hidden />}
selectedItem={selectedQuay}
onChange={setSelectedQuay}
disabled={!selectedStopPlace}
Expand Down
6 changes: 5 additions & 1 deletion tavla/app/(admin)/edit/[id]/components/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ function Footer({
placement="top"
id="tooltip-footer"
>
<ValidationInfoFilledIcon className="mb-3" size={20} />
<ValidationInfoFilledIcon
className="mb-3"
size={20}
aria-labelledby="tooltip-footer"
/>
</Tooltip>
</div>
<div className="h-full">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function Address({ bid, location }: { bid: TBoardID; location?: TLocation }) {
<ValidationInfoFilledIcon
className="md:mb-2 mb-3"
size={20}
aria-labelledby="tooltip-address"
/>
</Tooltip>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function DefaultColumns({
aria-label="Vis forklaring på kolonner"
onClick={() => setIsOpen(true)}
>
<QuestionFilledIcon size={24} />
<QuestionFilledIcon size={24} aria-hidden />
</IconButton>
</Tooltip>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tavla/app/components/ContactForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function ContactForm() {
action={submit}
className="flex flex-col gap-4 p-4 sm:p-6 "
>
<Paragraph as="h1" margin="none" className="font-bold">
<Paragraph as="h2" margin="none" className="font-bold">
Vi setter stor pris på tilbakemeldinger og innspill, og
bistår gjerne hvis du vil ha hjelp til å komme i gang
med Tavla.
Expand Down
11 changes: 9 additions & 2 deletions tavla/app/components/Expandable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ function Expandable({
onClick={() => setIsOpen(!isOpen)}
className="flex justify-between items-center px-6 py-4 bg-blue80 w-full rounded-t"
>
<Heading5 margin="none" className=" sm:text-base !text-lg">
<Heading5
margin="none"
className=" sm:text-base !text-lg"
as="h1"
>
{title}
</Heading5>
<IconButton className="border-0!">
<IconButton
className="border-0!"
aria-label={isOpen ? 'Åpne skjema' : 'Lukk skjema'}
>
{isOpen ? <DownArrowIcon /> : <UpArrowIcon />}
</IconButton>
</div>
Expand Down
4 changes: 3 additions & 1 deletion tavla/src/Shared/components/TransportIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ function TransportIcon({
const mode = transportMode ?? 'unknown'

const Component = getTransportIcon(mode, transportSubmode)

const altText =
mode === 'unknown' ? 'Unknown transport mode' : `${mode} transport mode`
return (
<Component
className={className ?? 'w-full h-full'}
fill={`var(--${mode}-color)`}
aria-label={altText}
/>
)
}
Expand Down

0 comments on commit f8a40c0

Please sign in to comment.