@@ -48,12 +48,14 @@ export class FieldNavigationPolicy implements INavigationPolicy<Field<any>> {
4848 let fieldIdx = input . fieldRow . indexOf ( current ) + 1 ;
4949 for ( let i = curIdx ; i < block . inputList . length ; i ++ ) {
5050 const newInput = block . inputList [ i ] ;
51- const fieldRow = newInput . fieldRow ;
52- if ( fieldIdx < fieldRow . length ) return fieldRow [ fieldIdx ] ;
53- fieldIdx = 0 ;
54- if ( newInput . connection ?. targetBlock ( ) ) {
55- return newInput . connection . targetBlock ( ) as BlockSvg ;
51+ if ( newInput . isVisible ( ) ) {
52+ const fieldRow = newInput . fieldRow ;
53+ if ( fieldIdx < fieldRow . length ) return fieldRow [ fieldIdx ] ;
54+ if ( newInput . connection ?. targetBlock ( ) ) {
55+ return newInput . connection . targetBlock ( ) as BlockSvg ;
56+ }
5657 }
58+ fieldIdx = 0 ;
5759 }
5860 return null ;
5961 }
@@ -73,12 +75,13 @@ export class FieldNavigationPolicy implements INavigationPolicy<Field<any>> {
7375 let fieldIdx = parentInput . fieldRow . indexOf ( current ) - 1 ;
7476 for ( let i = curIdx ; i >= 0 ; i -- ) {
7577 const input = block . inputList [ i ] ;
76- if ( input . connection ?. targetBlock ( ) && input !== parentInput ) {
77- return input . connection . targetBlock ( ) as BlockSvg ;
78+ if ( input . isVisible ( ) ) {
79+ if ( input . connection ?. targetBlock ( ) && input !== parentInput ) {
80+ return input . connection . targetBlock ( ) as BlockSvg ;
81+ }
82+ const fieldRow = input . fieldRow ;
83+ if ( fieldIdx > - 1 ) return fieldRow [ fieldIdx ] ;
7884 }
79- const fieldRow = input . fieldRow ;
80- if ( fieldIdx > - 1 ) return fieldRow [ fieldIdx ] ;
81-
8285 // Reset the fieldIdx to the length of the field row of the previous
8386 // input.
8487 if ( i - 1 >= 0 ) {
0 commit comments