File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919 const STORAGE_KEY = 'wplace-bot-scripts-v1' ;
2020 const BASE_URL_KEY = 'wplace-bot-base-url' ;
2121 const HOST_ID = 'wplace-bot-launcher-host' ;
22- const POPUP_NAME = 'wplace-bot-switcher' ;
2322 const TARGET_NAME_KEY = 'wplace-target-name' ;
24- const POPUP_W = 460 ;
25- const POPUP_H = 620 ;
2623
2724 // Add hotkey to open manager (Ctrl+Shift+M)
2825 document . addEventListener ( 'keydown' , function ( e ) {
595592
596593 // Keyboard for inline panel
597594 function onKeyDown ( e ) {
598- const tag = ( e . target && e . target . tagName ) || '' ;
599- if (
600- tag === 'INPUT' ||
601- tag === 'TEXTAREA' ||
602- ( e . target && e . target . isContentEditable )
603- ) {
604- return ;
605- }
595+ // Check if we're dealing with shadow DOM retargeting
596+ const actualTarget = e . composedPath ? e . composedPath ( ) [ 0 ] : e . target ;
597+ const actualTag = ( actualTarget && actualTarget . tagName || '' ) . toUpperCase ( ) ;
598+
599+ // Always allow ESC to close
606600 if ( e . key === 'Escape' ) {
607601 close ( ) ;
608602 e . preventDefault ( ) ;
609603 return ;
610604 }
605+
606+ // Don't trigger hotkeys when typing in input fields anywhere
607+ // Use actualTag to check the real target element
608+ if (
609+ actualTag === 'INPUT' ||
610+ actualTag === 'TEXTAREA' ||
611+ ( actualTarget && actualTarget . isContentEditable )
612+ ) {
613+ return ;
614+ }
615+
616+ // Only handle numeric hotkeys when not in an input field
611617 if ( e . key >= '0' && e . key <= '9' ) {
612618 const items = sortedScripts ( ) ;
613619 const idx = e . key === '0' ? 9 : Number ( e . key ) - 1 ;
749755 } , 1000 ) ;
750756 }
751757 }
752- } ) ( ) ;
758+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments