Skip to content

Commit

Permalink
Desktop: Fixes #9982: Show focus indicator when navigating with keybo…
Browse files Browse the repository at this point in the history
…ard (#9989)
  • Loading branch information
personalizedrefrigerator authored Mar 2, 2024
1 parent f0f6590 commit 4827d0b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/app-desktop/gui/NoteList/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
width: 2px;
height: 2px;
}

&:focus-visible {
outline: none;
}
}

.note-list-item-wrapper.-provisional {
Expand Down
19 changes: 17 additions & 2 deletions packages/app-desktop/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,23 @@ a {
to {transform: rotate(360deg);}
}

*:focus {
outline: none;

*:focus-visible {
outline: 1px solid var(--joplin-color-warn);
}

// The browser-default focus-visible indicator was originally removed for aesthetic
// reasons. However, this causes accessibility issues.
//
// As a comprimise, we disable the focus-visible indicator in cases where the user is
// probably not navigating with the keyboard. Note that :focus-visible alone is not
// sufficient because it matches any focused input (https://stackoverflow.com/a/66109577).
//
// See https://github.com/laurent22/joplin/issues/9982.
input:not([type=button]):not([type=checkbox]), select {
&:focus-visible {
outline: none;
}
}

/* =========================================================================================
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/services/noteList/defaultListRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const renderer: ListRenderer = {
background-color: var(--joplin-selected-color);
}
&:hover {
&:hover, :focus-visible > & > .content {
background-color: var(--joplin-background-color-hover3);
}
Expand Down

0 comments on commit 4827d0b

Please sign in to comment.