Skip to content

Commit

Permalink
correct focus styles
Browse files Browse the repository at this point in the history
  • Loading branch information
nielslyngsoe committed Nov 18, 2024
1 parent 1eff22c commit 13e6bc8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 14 deletions.
25 changes: 14 additions & 11 deletions packages/uui-card/lib/uui-card.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,18 @@ export class UUICardElement extends SelectOnlyMixin(
transition: box-shadow 100ms ease-out;
}
:host(*) {
/* TODO: implement globally shared outline style */
:host([selectable]:focus-visible) {
outline-color: var(--uui-color-focus);
outline-offset: 4px;
outline-width: var(--uui-card-border-width);
outline-style: solid;
outline-offset: var(--uui-card-border-width);
}
:host(*) * {
:host() * {
/* TODO: implement globally shared outline style */
outline-color: var(--uui-color-focus);
}
:host(:focus) {
outline-color: var(--uui-color-focus);
outline-width: var(--uui-card-border-width);
outline-style: solid;
outline-offset: var(--uui-card-border-width);
}
:host([error])::before {
content: '';
position: absolute;
Expand Down Expand Up @@ -148,6 +142,15 @@ export class UUICardElement extends SelectOnlyMixin(
color: inherit;
}
button:focus,
a:focus {
outline-color: var(--uui-color-focus);
outline-width: var(--uui-card-border-width);
outline-style: solid;
outline-offset: var(--uui-card-border-width);
border-radius: var(--uui-border-radius);
}
:host([selectable]) {
cursor: pointer;
}
Expand Down
17 changes: 14 additions & 3 deletions packages/uui-ref/lib/uui-ref.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ export class UUIRefElement extends SelectOnlyMixin(
transition: --uui-card-before-opacity 120ms;
}
:host(:focus) {
/** TODO: implement focus outline. */
outline-color: #6ab4f0;
:host([selectable]:focus-visible) {
outline-color: var(--uui-color-focus);
outline-width: var(--uui-card-border-width);
outline-style: solid;
outline-offset: var(--uui-card-border-width);
}
:host([error]) {
Expand Down Expand Up @@ -184,6 +186,15 @@ export class UUIRefElement extends SelectOnlyMixin(
color: inherit;
}
button:focus,
a:focus {
outline-color: var(--uui-color-focus);
outline-width: var(--uui-card-border-width);
outline-style: solid;
outline-offset: var(--uui-card-border-width);
border-radius: var(--uui-border-radius);
}
slot[name='actions'] {
display: flex;
align-items: center;
Expand Down

0 comments on commit 13e6bc8

Please sign in to comment.