Skip to content

Commit

Permalink
feat(skiplink): compose sr-only class (#2546)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barsnes authored Oct 1, 2024
1 parent f08ec98 commit 5a77def
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changeset/six-carrots-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@digdir/designsystemet-css": patch
"@digdir/designsystemet-react": patch
---

SkipLink: Remove ds-sr-only class
4 changes: 4 additions & 0 deletions packages/css/skiplink.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.ds-skiplink {
@composes ds-sr-only from './utilities.css';
}

.ds-skiplink:focus {
display: grid;
place-items: center;
Expand Down
7 changes: 1 addition & 6 deletions packages/react/src/components/SkipLink/SkipLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@ export type SkipLinkProps = {
} & AnchorHTMLAttributes<HTMLAnchorElement>;

export const SkipLink = ({
href,
children,
className,
...rest
}: SkipLinkProps): JSX.Element => {
return (
<a
href={href}
className={cl(`ds-sr-only`, 'ds-skiplink', className)}
{...rest}
>
<a className={cl('ds-skiplink', className)} {...rest}>
<p className='ds-skiplink__content'>{children}</p>
</a>
);
Expand Down

0 comments on commit 5a77def

Please sign in to comment.