@@ -643,22 +643,27 @@ final class GenericRole extends PrimaryRoleManager {
643643
644644 @override
645645 bool focusAsRouteDefault () {
646- final Focusable ? focusable = this .focusable;
647-
648- if (focusable != null ) {
649- return focusable.focusAsRouteDefault ();
646+ // Case 1: current node has input focus. Let the input focus system decide
647+ // default focusability.
648+ if (semanticsObject.isFocusable) {
649+ final Focusable ? focusable = this .focusable;
650+ if (focusable != null ) {
651+ return focusable.focusAsRouteDefault ();
652+ }
650653 }
651654
655+ // Case 2: current node is not focusable, but just a container of other
656+ // nodes or lacks a label. Do not focus on it and let the search continue.
652657 if (semanticsObject.hasChildren || ! semanticsObject.hasLabel) {
653- // Unless the container is explicitly focusable (handled above), do not
654- // autofocus on the container itself. Instead, look for a child to focus
655- // on.
656658 return false ;
657659 }
658660
661+ // Case 3: current node is visual/informational. Move just the
662+ // accessibility focus.
663+
659664 // Plain text nodes should not be focusable via keyboard or mouse. They are
660665 // only focusable for the purposes of focusing the screen reader. To achieve
661- // that -1 is used.
666+ // this the -1 value is used.
662667 //
663668 // See also:
664669 //
@@ -1773,7 +1778,6 @@ class SemanticsObject {
17731778 final bool shouldContinueVisiting = callback (this );
17741779
17751780 if (! shouldContinueVisiting) {
1776- print ('>>> ${primaryRole ?.runtimeType } stopped visitDepthFirstInTraversalOrder' );
17771781 return false ;
17781782 }
17791783
0 commit comments