Skip to content

Commit e1d04d5

Browse files
authored
[web-components] fix: add dropdown focusring for accessibility (microsoft#35116)
1 parent 8db966c commit e1d04d5

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "fix: add focus-ring to dropdown",
4+
"packageName": "@fluentui/web-components",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/web-components/src/dropdown/dropdown.styles.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import {
2525
colorNeutralStrokeAccessibleHover,
2626
colorNeutralStrokeAccessiblePressed,
2727
colorNeutralStrokeDisabled,
28+
colorStrokeFocus1,
29+
colorStrokeFocus2,
2830
colorTransparentBackground,
2931
colorTransparentStroke,
3032
colorTransparentStrokeInteractive,
@@ -151,6 +153,17 @@ export const styles = css`
151153
transition: scale ${durationUltraFast} ${curveDecelerateMid};
152154
}
153155
156+
/**
157+
* focus-ring style uses lingering :focus-within selector due to platform limitations
158+
* TODO: Convert selector to \`:host(:has(:focus-visible)) .control\` when browser support increases
159+
* ISSUE: https://issues.chromium.org/issues/40062355
160+
*/
161+
:host(:where(:focus-within)) .control {
162+
border-radius: ${borderRadiusMedium};
163+
box-shadow: inset 0 0 0 1px ${colorStrokeFocus1};
164+
outline: ${strokeWidthThick} solid ${colorStrokeFocus2};
165+
}
166+
154167
:host(:where(${openState}, :focus-within)) .control::after {
155168
scale: 1 1;
156169
transition-duration: ${durationNormal};

0 commit comments

Comments
 (0)