Skip to content

Commit

Permalink
Ryddet i aria-feil rundt ikoner uten aria-label eller aria-hidden.
Browse files Browse the repository at this point in the history
  • Loading branch information
sstensby committed Dec 17, 2024
1 parent ec10b15 commit 07ab830
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 38 deletions.
2 changes: 1 addition & 1 deletion client/src/Pages/MineSaker/MineSakerKort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const MineSakerKort = ({
variant="tertiary-neutral"
icon={
<NotePencilIcon
focusable="true"
aria-hidden
fontSize={"1.5rem"}
/>
}
Expand Down
26 changes: 15 additions & 11 deletions client/src/Pages/MineSaker/Sorteringsknapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,40 @@ export const Sorteringsknapper = ({ onSortChange }: SorteringsknapperProps) => {
);
};

const renderIcon = (type: "date" | "alphabetical") => {
if (sortType !== type) {
return <ArrowsUpDownIcon />;
} else if (isAscending) {
return <ArrowUpIcon />;
} else {
return <ArrowDownIcon />;
}
};


return (
<ButtonContainer>
<Button
size="medium"
variant="tertiary"
iconPosition="right"
icon={renderIcon("alphabetical")}
icon={<RenderIcon erSortertPåType={"alphabetical" === sortType} isAscending={isAscending} />}
onClick={() => handleSortToggle("alphabetical")}
aria-label="Sorter etter alfabetisk rekkefølge"
>
Alfabetisk rekkefølge
</Button>
<Button
size="medium"
variant="tertiary"
iconPosition="right"
icon={renderIcon("date")}
icon={<RenderIcon erSortertPåType={"date" === sortType} isAscending={isAscending} />}
onClick={() => handleSortToggle("date")}
aria-label="Sorter etter sist endret"
>
Sist endret
</Button>
</ButtonContainer>
);
};

const RenderIcon = ({ erSortertPåType, isAscending }: { erSortertPåType: boolean, isAscending: boolean }) => {
if (!erSortertPåType) {
return <ArrowsUpDownIcon aria-hidden />;
} else if (isAscending) {
return <ArrowUpIcon aria-label="Sortert stigende" />;
} else {
return <ArrowDownIcon aria-label="Sortert synkende" />;
}
};
8 changes: 4 additions & 4 deletions client/src/Pages/MineSaker/TeamDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function TeamDropdown({ open, setOpen, iaSak }: TeamModalProps) {
>
<Button
onClick={() => setOpen(true)}
icon={<ChevronDownIcon />}
icon={<ChevronDownIcon aria-hidden />}
iconPosition={"right"}
variant={"tertiary"}
size={"small"}
Expand All @@ -45,17 +45,17 @@ export default function TeamDropdown({ open, setOpen, iaSak }: TeamModalProps) {
<HStack align={"center"} gap={"1"}>
{brukerErEierAvSak ? (
<>
<PersonFillIcon />
<PersonFillIcon aria-hidden />
<BodyShort>Du eier saken</BodyShort>
</>
) : brukerFølgerSak ? (
<>
<HeartFillIcon />
<HeartFillIcon aria-hidden />
<BodyShort>Du følger saken</BodyShort>
</>
) : (
<>
<PersonGroupIcon />
<PersonGroupIcon aria-hidden />
<BodyShort>Følg eller ta eierskap</BodyShort>
</>
)}
Expand Down
4 changes: 2 additions & 2 deletions client/src/Pages/MineSaker/TeamInnhold.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ export default function TeamInnhold({ iaSak }: { iaSak: IASak }) {
>
<HStack gap={"2"} align={"center"}>
{iaSak.eidAv !== brukerIdent ? (
<PersonIcon />
<PersonIcon aria-hidden />
) : (
<PersonFillIcon />
<PersonFillIcon aria-hidden />
)}
{iaSak.eidAv !== brukerIdent ? (
<BodyShort>Ta eierskap</BodyShort>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ export const BehovsvurderingCardHeaderInnhold = ({
true,
)
}
icon={<TrashIcon />}
icon={<TrashIcon aria-hidden />}
aria-label="Slett behovsvurdering"
/>
)}
</>
Expand Down Expand Up @@ -301,7 +302,8 @@ export const BehovsvurderingCardHeaderInnhold = ({
true,
)
}
icon={<TrashIcon />}
icon={<TrashIcon aria-hidden />}
aria-label="Slett behovsvurdering"
/>
</>
)}
Expand Down
2 changes: 1 addition & 1 deletion client/src/Pages/Virksomhet/Kartlegging/EksportVisning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ const EksportVisning = ({
<>
<Button
loading={erIEksportMode}
icon={<FilePdfIcon fontSize="1.5rem" />}
icon={<FilePdfIcon fontSize="1.5rem" aria-hidden />}
variant="secondary"
size="small"
onClick={(e) => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/Pages/Virksomhet/Plan/EditTemaKnapp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function EditTemaKnapp({
loggModalÅpnet("Rediger tema");
setModalOpen(true);
}}
icon={<DocPencilIcon />}
icon={<DocPencilIcon aria-hidden />}
>
Rediger tema
</Button>
Expand Down
2 changes: 1 addition & 1 deletion client/src/Pages/Virksomhet/Plan/EksportVisning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function EksportVisning({
return (
<Button
loading={lagrer}
icon={<FilePdfIcon fontSize="1.5rem" />}
icon={<FilePdfIcon fontSize="1.5rem" aria-hidden />}
variant="secondary"
size="small"
onClick={(e) => {
Expand Down
2 changes: 1 addition & 1 deletion client/src/Pages/Virksomhet/Plan/LeggTilTemaKnapp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export default function LeggTilTemaKnapp({
size="medium"
iconPosition="left"
variant="primary"
icon={<NotePencilIcon />}
icon={<NotePencilIcon aria-hidden />}
style={{ margin: "1rem", minWidth: "10.5rem" }}
onClick={() => {
loggModalÅpnet("Rediger plan");
Expand Down
4 changes: 2 additions & 2 deletions client/src/Pages/Virksomhet/Samarbeid/EierskapKnapp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ export function EierskapKnapp({ iaSak }: { iaSak?: IASak }) {
return (
<Button
onClick={() => setIsModalOpen(true)}
icon={<ChevronDownIcon />}
icon={<ChevronDownIcon aria-hidden />}
iconPosition={"right"}
variant={"tertiary"}
size={"small"}
disabled={true}
>
<HStack align={"center"} gap={"1"}>
<CircleSlashIcon />
<CircleSlashIcon aria-hidden />
<BodyShort>Ingen aktiv sak</BodyShort>
</HStack>
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ export const EndreSamarbeidModal = ({
<SquareButton
icon={
<TrashIcon
focusable="true"
title={`Slett "${samarbeid.navn}"`}
fontSize="2rem"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ export const EvalueringCardHeaderInnhold = ({
true,
)
}
icon={<TrashIcon />}
icon={<TrashIcon aria-hidden />}
aria-label="Slett behovsvurdering"
/>
)}
</>
Expand Down Expand Up @@ -291,7 +292,8 @@ export const EvalueringCardHeaderInnhold = ({
true,
)
}
icon={<TrashIcon />}
icon={<TrashIcon aria-hidden />}
aria-label="Slett behovsvurdering"
/>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const SamarbeidsDropdown = ({
<Dropdown>
<Button
as={Dropdown.Toggle}
icon={<ChevronDownIcon />}
icon={<ChevronDownIcon aria-hidden />}
iconPosition="right"
variant="primary-neutral"
size="small"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function SaksgangDropdownToggle({
size={"small"}
variant={"primary"}
iconPosition={"right"}
icon={<ChevronDownIcon />}
icon={<ChevronDownIcon aria-hidden />}
>
Ikke aktiv
</IkkeAktivKnapp>
Expand All @@ -84,7 +84,7 @@ export function SaksgangDropdownToggle({
size={"small"}
variant={"primary"}
iconPosition={"right"}
icon={<ChevronDownIcon />}
icon={<ChevronDownIcon aria-hidden />}
>
{penskrivIAStatus(iaSak.status)}
</VurderesKnapp>
Expand All @@ -95,7 +95,7 @@ export function SaksgangDropdownToggle({
size={"small"}
variant={"primary"}
iconPosition={"right"}
icon={<ChevronDownIcon />}
icon={<ChevronDownIcon aria-hidden />}
>
{penskrivIAStatus(iaSak.status)}
</KontaktesKnapp>
Expand All @@ -106,7 +106,7 @@ export function SaksgangDropdownToggle({
size={"small"}
variant={"primary"}
iconPosition={"right"}
icon={<ChevronDownIcon />}
icon={<ChevronDownIcon aria-hidden />}
>
{penskrivIAStatus(iaSak.status)}
</KartleggesKnapp>
Expand All @@ -117,7 +117,7 @@ export function SaksgangDropdownToggle({
size={"small"}
variant={"primary"}
iconPosition={"right"}
icon={<ChevronDownIcon />}
icon={<ChevronDownIcon aria-hidden />}
>
{penskrivIAStatus(iaSak.status)}
</ViBistårKnapp>
Expand All @@ -128,7 +128,7 @@ export function SaksgangDropdownToggle({
size={"small"}
variant={"primary"}
iconPosition={"right"}
icon={<ChevronDownIcon />}
icon={<ChevronDownIcon aria-hidden />}
>
{penskrivIAStatus(iaSak.status)}
</IkkeAktivKnapp>
Expand All @@ -139,7 +139,7 @@ export function SaksgangDropdownToggle({
size={"small"}
variant={"primary"}
iconPosition={"right"}
icon={<ChevronDownIcon />}
icon={<ChevronDownIcon aria-hidden />}
>
{penskrivIAStatus(iaSak.status)}
</IkkeAktuellKnapp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default function VirksomhetOgSamarbeidsHeader({

{gjeldendeSamarbeid && (
<>
<ChevronRightIcon fontSize="2rem" />
<ChevronRightIcon fontSize="2rem" aria-hidden />
<Heading level={"1"} size={"large"}>
{defaultNavnHvisTomt(
gjeldendeSamarbeid.navn,
Expand Down

0 comments on commit 07ab830

Please sign in to comment.