Skip to content

Commit 3381269

Browse files
committed
✨(frontend) refine focus outline with shadow for visual consistency
aligns focus state with app style by adding background shadow to outline Signed-off-by: Cyril <[email protected]>
1 parent 942c90c commit 3381269

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/frontend/apps/impress/src/features/docs/doc-tree/components/DocSubPageItem.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ export const DocSubPageItem = (props: TreeViewNodeProps<Doc>) => {
127127
background: var(--c--theme--colors--greyscale-100);
128128
}
129129
}
130+
.c__tree-view--node.isFocused {
131+
outline: none !important;
132+
box-shadow: 0 0 0 2px var(--c--theme--colors--primary-500) !important;
133+
border-radius: 4px;
134+
}
130135
&:hover {
131136
background-color: var(--c--theme--colors--greyscale-100);
132137
border-radius: 4px;

src/frontend/apps/impress/src/features/docs/doc-tree/components/DocTree.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,15 @@ export const DocTree = ({ currentDoc }: DocTreeProps) => {
181181
role="tree"
182182
aria-label={t('Document tree')}
183183
$css={css`
184+
/* Remove outline from TreeViewItem wrapper elements */
185+
.c__tree-view--row {
186+
outline: none !important;
187+
188+
&:focus-visible {
189+
outline: none !important;
190+
}
191+
}
192+
184193
.c__tree-view--container {
185194
z-index: 1;
186195
margin-top: -10px;
@@ -200,7 +209,7 @@ export const DocTree = ({ currentDoc }: DocTreeProps) => {
200209
<Box
201210
data-testid="doc-tree-root-item"
202211
role="treeitem"
203-
aria-label={`${t('Root document')}: ${treeContext.root?.title || t('Untitled document')}`}
212+
aria-label={`${t('Root document {{title}}', { title: treeContext.root?.title || t('Untitled document') })}`}
204213
aria-selected={rootIsSelected}
205214
tabIndex={0}
206215
onFocus={handleRootFocus}
@@ -217,6 +226,12 @@ export const DocTree = ({ currentDoc }: DocTreeProps) => {
217226
background-color: var(--c--theme--colors--greyscale-100);
218227
}
219228
229+
&:focus-visible {
230+
outline: none !important;
231+
box-shadow: 0 0 0 2px var(--c--theme--colors--primary-500) !important;
232+
border-radius: 4px;
233+
}
234+
220235
.doc-tree-root-item-actions {
221236
display: 'flex';
222237
opacity: ${rootActionsOpen ? '1' : '0'};

0 commit comments

Comments
 (0)