@@ -20,6 +20,7 @@ import {BlockSearcher} from './block_searcher';
2020export class ToolboxSearchCategory extends Blockly . ToolboxCategory {
2121 private static readonly START_SEARCH_SHORTCUT = 'startSearch' ;
2222 static readonly SEARCH_CATEGORY_KIND = 'search' ;
23+ private readonly SEARCH_INPUT_ID = 'toolbox-search-input' ;
2324 private searchField ?: HTMLInputElement ;
2425 private blockSearcher = new BlockSearcher ( ) ;
2526
@@ -50,6 +51,7 @@ export class ToolboxSearchCategory extends Blockly.ToolboxCategory {
5051 protected override createDom_ ( ) : HTMLDivElement {
5152 const dom = super . createDom_ ( ) ;
5253 this . searchField = document . createElement ( 'input' ) ;
54+ this . searchField . id = this . SEARCH_INPUT_ID ;
5355 this . searchField . type = 'search' ;
5456 this . searchField . placeholder = 'Search' ;
5557 this . workspace_ . RTL
@@ -58,7 +60,7 @@ export class ToolboxSearchCategory extends Blockly.ToolboxCategory {
5860 this . searchField . addEventListener ( 'keyup' , ( event ) => {
5961 if ( event . key === 'Escape' ) {
6062 this . parentToolbox_ . clearSelection ( ) ;
61- return true ;
63+ return ;
6264 }
6365
6466 this . matchBlocks ( ) ;
@@ -67,6 +69,11 @@ export class ToolboxSearchCategory extends Blockly.ToolboxCategory {
6769 return dom ;
6870 }
6971
72+ /** The ID of the toolbox item must match the ID of the focusable node. */
73+ override getId ( ) : string {
74+ return this . SEARCH_INPUT_ID ;
75+ }
76+
7077 /**
7178 * Returns the numerical position of this category in its parent toolbox.
7279 *
0 commit comments