Skip to content

Commit 2de8446

Browse files
committed
Add focus highlight for mutator buttons on blocks (lists and custom)
#357
1 parent 808aee6 commit 2de8446

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

style/blockly.css

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
--color-search-highlight: #ed808b;
99
--color-shadow: grey;
1010
--color-outline-focus: #fc3;
11+
--block-outline-focus: #fff200;
1112

1213
/* Dropdown & menu semantics */
1314
--color-dropdown-text: var(--color-text);
@@ -506,6 +507,7 @@ body[data-theme="dark"] .blocklyTreeLabel {
506507
border-radius: 4px;
507508
}
508509

510+
509511
/* Add custom selection outline for both level 1 and 2 categories */
510512
.blocklyToolboxCategoryContainer[aria-selected="true"][aria-level="1"]
511513
> .blocklyToolboxCategory,
@@ -677,7 +679,33 @@ body[data-theme="dark"] .blocklyTreeLabel {
677679
outline-offset: -2px;
678680
border-radius: 4px;
679681
}
680-
/* Your injection container */
682+
683+
/* Keyboard focus for image BUTTON fields only (e.g. plus/minus/toggle icons) */
684+
.blocklyKeyboardNavigation .blocklyActiveFocus.blocklyImageField {
685+
outline: 5px solid var(--block-outline-focus);
686+
outline-offset: 2px;
687+
}
688+
689+
.blocklyKeyboardNavigation .blocklyActiveFocus.blocklyImageField image[style*="cursor: pointer"] {
690+
stroke: var(--block-outline-focus);
691+
stroke-width: 5px;
692+
}
693+
694+
/* Passive focus: lower emphasis */
695+
.blocklyKeyboardNavigation .blocklyPassiveFocus.blocklyImageField {
696+
outline: 5px dashed var(--block-outline-focus);
697+
outline-offset: 2px;
698+
}
699+
700+
.blocklyKeyboardNavigation .blocklyPassiveFocus.blocklyImageField image[style*="cursor: pointer"] {
701+
stroke: var(--color-outline-focus);
702+
stroke-width: 5px;
703+
stroke-dasharray: 4 2; /* Blockly-style short dash */
704+
stroke-linecap: butt; /* square dash ends */
705+
vector-effect: non-scaling-stroke;
706+
}
707+
708+
/* Blockly injection container */
681709
#blocklyDiv {
682710
position: relative;
683711
overflow: hidden; /* clip overlay so it can't grow layout */

0 commit comments

Comments
 (0)