Skip to content

Commit

Permalink
add layer to utility
Browse files Browse the repository at this point in the history
  • Loading branch information
Barsnes committed Apr 11, 2024
1 parent d90f904 commit aaf4616
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 34 deletions.
36 changes: 19 additions & 17 deletions packages/css/react-css-modules.css
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
/**
@layer fds.utility {
/**
* Visually hide an element, but leave it available for screen readers
*/
.fds-utility-visuallyHidden-1ed11112 {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
overflow: hidden;
padding: 0;
position: absolute;
white-space: nowrap;
width: 1px;
}
.fds-utility-visuallyHidden-1ed11112 {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
overflow: hidden;
padding: 0;
position: absolute;
white-space: nowrap;
width: 1px;
}

/**
/**
* Apply a focus outline on an element when it is focused with keyboard
*/
.fds-utility-focusable-1ed11112:focus-visible {
--fds-focus-border-width: 3px;
.fds-utility-focusable-1ed11112:focus-visible {
--fds-focus-border-width: 3px;

outline: var(--fds-focus-border-width) solid var(--fds-semantic-border-focus-outline);
outline-offset: var(--fds-focus-border-width);
box-shadow: 0 0 0 var(--fds-focus-border-width) var(--fds-semantic-border-focus-boxshadow);
outline: var(--fds-focus-border-width) solid var(--fds-semantic-border-focus-outline);
outline-offset: var(--fds-focus-border-width);
box-shadow: 0 0 0 var(--fds-focus-border-width) var(--fds-semantic-border-focus-boxshadow);
}
}

@layer fds.button {
Expand Down
36 changes: 19 additions & 17 deletions packages/react/src/utilities/utility.module.css
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
/**
@layer fds.utility {
/**
* Visually hide an element, but leave it available for screen readers
*/
.visuallyHidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
overflow: hidden;
padding: 0;
position: absolute;
white-space: nowrap;
width: 1px;
}
.visuallyHidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
overflow: hidden;
padding: 0;
position: absolute;
white-space: nowrap;
width: 1px;
}

/**
/**
* Apply a focus outline on an element when it is focused with keyboard
*/
.focusable:focus-visible {
--fds-focus-border-width: 3px;
.focusable:focus-visible {
--fds-focus-border-width: 3px;

outline: var(--fds-focus-border-width) solid var(--fds-semantic-border-focus-outline);
outline-offset: var(--fds-focus-border-width);
box-shadow: 0 0 0 var(--fds-focus-border-width) var(--fds-semantic-border-focus-boxshadow);
outline: var(--fds-focus-border-width) solid var(--fds-semantic-border-focus-outline);
outline-offset: var(--fds-focus-border-width);
box-shadow: 0 0 0 var(--fds-focus-border-width) var(--fds-semantic-border-focus-boxshadow);
}
}

0 comments on commit aaf4616

Please sign in to comment.