File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import {
2727 FieldValidator ,
2828 UnattachedFieldError ,
2929} from './field.js' ;
30+ import type { IFocusableNode } from './interfaces/i_focusable_node.js' ;
3031import { Msg } from './msg.js' ;
3132import * as renderManagement from './render_management.js' ;
3233import * as aria from './utils/aria.js' ;
@@ -582,6 +583,28 @@ export abstract class FieldInput<T extends InputTypes> extends Field<
582583 ) ;
583584 WidgetDiv . hideIfOwner ( this ) ;
584585 dropDownDiv . hideWithoutAnimation ( ) ;
586+ } else if ( e . key === 'Tab' ) {
587+ e . preventDefault ( ) ;
588+ const cursor = this . workspace_ ?. getCursor ( ) ;
589+
590+ const isValidDestination = ( node : IFocusableNode | null ) =>
591+ ( node instanceof FieldInput ||
592+ ( node instanceof BlockSvg && node . isSimpleReporter ( ) ) ) &&
593+ node !== this . getSourceBlock ( ) ;
594+
595+ let target = e . shiftKey
596+ ? cursor ?. getPreviousNode ( this , isValidDestination , false )
597+ : cursor ?. getNextNode ( this , isValidDestination , false ) ;
598+ target =
599+ target instanceof BlockSvg && target . isSimpleReporter ( )
600+ ? target . getFields ( ) . next ( ) . value
601+ : target ;
602+
603+ if ( target instanceof FieldInput ) {
604+ WidgetDiv . hideIfOwner ( this ) ;
605+ dropDownDiv . hideWithoutAnimation ( ) ;
606+ target . showEditor ( ) ;
607+ }
585608 }
586609 }
587610
You can’t perform that action at this time.
0 commit comments