File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -632,6 +632,12 @@ async def press_keys() -> None:
632632 print (f"press { key !r} (char={ char !r} )" )
633633 key_event = events .Key (self , key , char )
634634 driver .send_event (key_event )
635+ # TODO: A bit of a fudge - extra sleep after tabbing to help guard against race
636+ # condition between widget-level key handling and app/screen level handling.
637+ # More information here: https://github.com/Textualize/textual/issues/1009
638+ # This conditional sleep can be removed after that issue is closed.
639+ if key == "tab" :
640+ await asyncio .sleep (0.05 )
635641 await asyncio .sleep (0.02 )
636642
637643 await app ._animator .wait_for_idle ()
Original file line number Diff line number Diff line change @@ -58,9 +58,9 @@ def test_checkboxes(snap_compare):
5858def test_input_and_focus (snap_compare ):
5959 press = [
6060 "tab" ,
61- * list ( "Darren" ) , # Focus first input, write "Darren"
61+ * "Darren" , # Focus first input, write "Darren"
6262 "tab" ,
63- * list ( "Burns" ) , # Tab focus to second input, write "Burns"
63+ * "Burns" , # Tab focus to second input, write "Burns"
6464 ]
6565 assert snap_compare ("docs/examples/widgets/input.py" , press = press )
6666
You can’t perform that action at this time.
0 commit comments