Skip to content

Commit 39dbe81

Browse files
chore: consistently use focus-within
I think this behaves more or less the same but is easier to follow.
1 parent 250494c commit 39dbe81

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/index.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ export class KeyboardNavigation {
188188
/* Blocks with passive focus except when widget/dropdown div in use. */
189189
.blocklyKeyboardNavigation:not(
190190
:has(
191-
.blocklyDropDownDiv > .blocklyDropDownContent > *,
192-
.blocklyWidgetDiv > *
191+
.blocklyDropDownDiv:focus-within,
192+
.blocklyWidgetDiv:focus-within
193193
)
194194
)
195195
.blocklyPassiveFocus:is(
@@ -199,17 +199,17 @@ export class KeyboardNavigation {
199199
/* Fields with passive focus except when widget/dropdown div in use. */
200200
.blocklyKeyboardNavigation:not(
201201
:has(
202-
.blocklyDropDownDiv > .blocklyDropDownContent > *,
203-
.blocklyWidgetDiv > *
202+
.blocklyDropDownDiv:focus-within,
203+
.blocklyWidgetDiv:focus-within
204204
)
205205
)
206206
.blocklyPassiveFocus.blocklyField
207207
> .blocklyFieldRect,
208208
/* Icons with passive focus except when widget/dropdown div in use. */
209209
.blocklyKeyboardNavigation:not(
210210
:has(
211-
.blocklyDropDownDiv > .blocklyDropDownContent > *,
212-
.blocklyWidgetDiv > *
211+
.blocklyDropDownDiv:focus-within,
212+
.blocklyWidgetDiv:focus-within
213213
)
214214
)
215215
.blocklyPassiveFocus.blocklyIconGroup
@@ -273,7 +273,10 @@ export class KeyboardNavigation {
273273
.blocklyWorkspace
274274
.blocklyWorkspaceFocusRing,
275275
/* Focus in widget div considered to be in workspace. */
276-
.blocklyKeyboardNavigation:has(.blocklyWidgetDiv:focus-within)
276+
.blocklyKeyboardNavigation:has(
277+
.blocklyWidgetDiv:focus-within,
278+
.blocklyDropDownDiv:focus-within
279+
)
277280
.blocklyWorkspace
278281
.blocklyWorkspaceFocusRing {
279282
stroke: var(--blockly-active-tree-color);

0 commit comments

Comments
 (0)