Skip to content

Commit

Permalink
feat(styles): extended focus-style mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
schaertim committed Sep 25, 2024
1 parent 8c78c13 commit ae4e861
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/cuddly-panthers-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': patch
---

Extended the `focus-style` mixin by optional parameters to use it together with tokens.
13 changes: 9 additions & 4 deletions packages/styles/src/mixins/_utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,17 @@
outline: none;
}

@mixin focus-style($additional-selector: '') {
@mixin focus-style(
$additional-selector: '',
$offset: spacing.$size-line,
$width: spacing.$size-line,
$color: var(--post-focus-color)
) {
&#{$additional-selector} {
outline-style: none !important; // !important is needed to override bootstrap .form-control:focus
outline-offset: spacing.$size-line !important;
outline-width: spacing.$size-line !important;
outline-color: var(--post-focus-color) !important;
outline-offset: $offset !important;
outline-width: $width !important;
outline-color: $color !important;
}

// :has(:focus-visible) mimic a focus-visible-within pseudo-class
Expand Down

0 comments on commit ae4e861

Please sign in to comment.