Skip to content

Commit d34f4a4

Browse files
authored
Merge pull request #5420 from Textualize/select-update
Select update
2 parents 2fb527b + 206d70d commit d34f4a4

File tree

4 files changed

+216
-8
lines changed

4 files changed

+216
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111
### Fixed
1212

1313
- Fixed `Pilot.click` not working with `times` parameter https://github.com/Textualize/textual/pull/5398
14+
- Fixed select refocusing itself too late https://github.com/Textualize/textual/pull/5420
1415

1516
### Added
1617

src/textual/widgets/_select.py

+3-7
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ def _watch_expanded(self, expanded: bool) -> None:
610610
value = self.value
611611
for index, (_prompt, prompt_value) in enumerate(self._options):
612612
if value == prompt_value:
613-
self.call_after_refresh(overlay.select, index)
613+
overlay.select(index)
614614
break
615615
self.query_one(SelectCurrent).has_value = True
616616

@@ -637,12 +637,8 @@ def _update_selection(self, event: SelectOverlay.UpdateSelection) -> None:
637637
if value != self.value:
638638
self.value = value
639639

640-
async def update_focus() -> None:
641-
"""Update focus and reset overlay."""
642-
self.focus()
643-
self.expanded = False
644-
645-
self.call_after_refresh(update_focus) # Prevents a little flicker
640+
self.focus()
641+
self.expanded = False
646642

647643
def action_show_overlay(self) -> None:
648644
"""Show the overlay."""

0 commit comments

Comments
 (0)