Skip to content

Commit

Permalink
Improve focus-visible outlines in navigation (#6061)
Browse files Browse the repository at this point in the history
* feat add focus_visible atom

* feat use focus_visible atom in Button.tsx style

* Tweak

---------

Co-authored-by: Dan Abramov <[email protected]>
  • Loading branch information
Tahul and gaearon authored Nov 1, 2024
1 parent 7111e38 commit c580f20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/alf/atoms.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Platform, StyleSheet, ViewStyle} from 'react-native'
import {Platform, StyleProp, StyleSheet, ViewStyle} from 'react-native'

import * as tokens from '#/alf/tokens'
import {native, web} from '#/alf/util/platform'
Expand Down Expand Up @@ -887,6 +887,9 @@ export const atoms = {
user_select_all: {
userSelect: 'all',
},
outline_inset_1: {
outlineOffset: '-1px',
} as StyleProp<ViewStyle>,

/*
* Text decoration
Expand Down
9 changes: 8 additions & 1 deletion src/view/shell/desktop/LeftNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,14 @@ function NavItem({count, href, icon, iconFilled, label}: NavItemProps) {

return (
<PressableWithHover
style={[a.flex_row, a.align_center, a.p_md, a.rounded_sm, a.gap_sm]}
style={[
a.flex_row,
a.align_center,
a.p_md,
a.rounded_sm,
a.gap_sm,
a.outline_inset_1,
]}
hoverStyle={t.atoms.bg_contrast_25}
// @ts-ignore the function signature differs on web -prf
onPress={onPressWrapped}
Expand Down

0 comments on commit c580f20

Please sign in to comment.