File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,8 +23,11 @@ export class FieldDropdown extends Blockly.FieldDropdown {
2323 this . clickTargetRect = this . borderRect_ ! ;
2424 this . clickTargetRect . setAttribute ( "stroke-opacity" , "0" ) ;
2525 this . clickTargetRect . setAttribute ( "fill-opacity" , "0" ) ;
26- this . clickTargetRect . style . strokeOpacity = '0' ;
27- this . clickTargetRect . style . fillOpacity = '0' ;
26+
27+ if ( ! this . hasSiblingLabel ( ) ) {
28+ this . clickTargetRect . style . strokeOpacity = "0" ;
29+ this . clickTargetRect . style . fillOpacity = "0" ;
30+ }
2831
2932 // Make sure to unset the border rect so that it isn't included in size
3033 // calculations
@@ -55,6 +58,17 @@ export class FieldDropdown extends Blockly.FieldDropdown {
5558 return super . shouldAddBorderRect_ ( ) ;
5659 }
5760
61+ protected hasSiblingLabel ( ) : boolean {
62+ for ( const input of this . sourceBlock_ . inputList ) {
63+ for ( const field of input . fieldRow ) {
64+ if ( field === this ) continue ;
65+
66+ if ( field instanceof Blockly . FieldLabel ) return true ;
67+ }
68+ }
69+ return false ;
70+ }
71+
5872 protected override bindEvents_ ( ) {
5973 if ( this . shouldAddBorderRect_ ( ) ) {
6074 super . bindEvents_ ( ) ;
Original file line number Diff line number Diff line change @@ -526,13 +526,19 @@ export class FieldGridPicker extends FieldDropdownGrid implements FieldCustom {
526526 searchBar . setSelectionRange ( 0 , searchBar . value . length ) ;
527527 } ) ;
528528
529+ let lastSearch = "" ;
530+
529531 // Search on key change
530532 searchBar . addEventListener ( "keyup" , pxt . Util . debounce ( ( e : KeyboardEvent ) => {
531533 if ( e . code === "Tab" ) {
532534 return ;
533535 }
534536
535- let text = searchBar . value ;
537+ let text = pxt . U . escapeForRegex ( searchBar . value ) ;
538+ if ( text === lastSearch ) {
539+ return ;
540+ }
541+ lastSearch = text ;
536542 let re = new RegExp ( text , "i" ) ;
537543 let filteredOptions = options . filter ( ( block ) => {
538544 const alt = ( block as any ) [ 0 ] . alt ; // Human-readable text or image.
@@ -554,8 +560,7 @@ export class FieldGridPicker extends FieldDropdownGrid implements FieldCustom {
554560
555561 // Select the first item if the enter key is pressed
556562 searchBar . addEventListener ( "keyup" , ( e : KeyboardEvent ) => {
557- const code = e . which ;
558- if ( code == 13 ) { /* Enter key */
563+ if ( e . code === "Enter" ) {
559564 // Select the first item in the list
560565 const firstRow = tableContainer . childNodes [ 0 ] as HTMLElement ;
561566 if ( firstRow ) {
You can’t perform that action at this time.
0 commit comments