Repository: flutter
Issue: Assert triggered in focus traversal: RenderBox was not laid out
Labels: a: text input,c: crash,framework,f: routes,f: focus,has reproducible steps,P2,found in release: 3.3,found in release: 3.5,team-framework,triaged-framework

Hi,

the following snippet causes an assert during focus traversal that a RenderBox has not been laid out (it doesn't have a size).
Repro steps are: click on "Click me", then press tab.

```dart
import 'package:flutter/material.dart';

main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          _EditField(),
          _Panel(),
        ],
      ),
    );
  }
}

class _EditField extends StatefulWidget {
  @override
  State<_EditField> createState() => _EditFieldState();
}

class _EditFieldState extends State<_EditField> {
  final _focusNode = FocusNode(debugLabel: '_EditField');

  @override
  Widget build(BuildContext context) {
    return TextField(
      focusNode: _focusNode,
      decoration: const InputDecoration(
        contentPadding: EdgeInsets.fromLTRB(12, 18, 12, 18),
        filled: true,
        hintText: 'Click me',
      ),
    );
  }
}

class _Panel extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: 300.0,
      height: 100.0,
      child: Navigator(
        requestFocus: false,
        pages: <MaterialPage<Object>>[
          MaterialPage<Object>(name: 'root', child: Container()),
          const MaterialPage<Object>(name: 'panel', child: Text('Then press tab')),
        ],
        onPopPage: (_, __) => false,
      ),
    );
  }
}
```

Here is the output from the chrome console:
```
══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
js_primitives.dart:30 The following assertion was thrown while processing the key message handler:
js_primitives.dart:30 Assertion failed: google3:///third_party/dart/flutter/lib/src/rendering/box.dart:2009:12
js_primitives.dart:30 hasSize
js_primitives.dart:30 "RenderBox was not laid out: RenderSemanticsAnnotations#6193f NEEDS-LAYOUT NEEDS-PAINT"
js_primitives.dart:30 
js_primitives.dart:30 When the exception was thrown, this was the stack:
js_primitives.dart:30 dart:sdk_internal 5653:11                                   throw_
js_primitives.dart:30 dart:sdk_internal 5568:15                                   assertFailed
js_primitives.dart:30 package:flutter/src/rendering/box.dart 2009:12              get size
js_primitives.dart:30 package:flutter/src/rendering/box.dart 2147:44              get semanticBounds
js_primitives.dart:30 package:flutter/src/widgets/focus_manager.dart 796:90       get rect
js_primitives.dart:30 package:flutter/src/widgets/focus_traversal.dart 872:20     new
js_primitives.dart:30 package:flutter/src/widgets/focus_traversal.dart 1115:49    <fn>
js_primitives.dart:30 package:flutter/src/widgets/focus_traversal.dart 1115:75    sortDescendants
js_primitives.dart:30 package:flutter/src/widgets/focus_traversal.dart 333:55     [_sortAllDescendants]
js_primitives.dart:30 package:flutter/src/widgets/focus_traversal.dart 406:41     [_moveFocus]
js_primitives.dart:30 package:flutter/src/widgets/focus_traversal.dart 238:39     next
js_primitives.dart:30 package:flutter/src/widgets/focus_manager.dart 1136:46      nextFocus
js_primitives.dart:30 package:flutter/src/widgets/focus_traversal.dart 1687:5     invoke
js_primitives.dart:30 package:flutter/src/widgets/actions.dart 580:20             invokeAction
js_primitives.dart:30 package:flutter/src/widgets/shortcuts.dart 815:36           handleKeypress
js_primitives.dart:30 package:flutter/src/widgets/shortcuts.dart 999:20           [_handleOnKey]
js_primitives.dart:30 package:flutter/src/widgets/focus_manager.dart 1682:25      [_handleKeyMessage]
js_primitives.dart:30 package:flutter/src/services/hardware_keyboard.dart 897:16  [_dispatchKeyMessage]
js_primitives.dart:30 package:flutter/src/services/hardware_keyboard.dart 962:17  handleRawKeyMessage
js_primitives.dart:30 dart:sdk_internal 42528:34                                  runBody
js_primitives.dart:30 dart:sdk_internal 42560:7                                   _async
js_primitives.dart:30 package:flutter/src/services/hardware_keyboard.dart 923:51  handleRawKeyMessage
js_primitives.dart:30 package:flutter/src/services/platform_channel.dart 214:49   <fn>
js_primitives.dart:30 dart:sdk_internal 42528:34                                  runBody
js_primitives.dart:30 dart:sdk_internal 42560:7                                   _async
js_primitives.dart:30 package:flutter/src/services/platform_channel.dart 213:58   <fn>
js_primitives.dart:30 package:flutter/src/services/binding.dart 393:35            <fn>
js_primitives.dart:30 dart:sdk_internal 42528:34                                  runBody
js_primitives.dart:30 dart:sdk_internal 42560:7                                   _async
js_primitives.dart:30 package:flutter/src/services/binding.dart 390:46            <fn>
js_primitives.dart:30 dart:sdk_internal 228129:7                                  invoke2
js_primitives.dart:30 dart:sdk_internal 141412:15                                 invoke
js_primitives.dart:30 dart:sdk_internal 141489:54                                 push
js_primitives.dart:30 dart:sdk_internal 141587:29                                 push
js_primitives.dart:30 dart:sdk_internal 198205:27                                 invokeOnPlatformMessage
js_primitives.dart:30 dart:sdk_internal 200752:49                                 [_handleHtmlEvent]
js_primitives.dart:30 dart:sdk_internal 200777:29                                 <fn>
js_primitives.dart:30 dart:sdk_internal 5857:16                                   _checkAndCall
js_primitives.dart:30 dart:sdk_internal 5862:17                                   dcall
js_primitives.dart:30 dart:sdk_internal 66501:21                                  ret
js_primitives.dart:30 
js_primitives.dart:30 KeyMessage: KeyMessage([KeyDownEvent#a2d91(physicalKey: PhysicalKeyboardKey#7002b(usbHidUsage:
js_primitives.dart:30   "0x0007002b", debugName: "Tab"), logicalKey: LogicalKeyboardKey#b151c(keyId: "0x100000009",
js_primitives.dart:30   keyLabel: "Tab", debugName: "Tab"), character: null, timeStamp: 0:00:04.291300)])
js_primitives.dart:30 ════════════════════════════════════════════════════════════════════════════════════════════════════
```