Skip to content

Fix focus

Mateusz Żebrak requested to merge mzebrak/focus-fix into develop

Since terminal was redesigned in 314ebc2b, setting focus on the first focusable element on the screen was broken.

It was caused by this logic:

in terminal.py

  def on_terminal_expanded(self, expanded: bool) -> None:
        if not expanded:
            self.add_class("-hidden")
            self._restore_focus()    <--
        ...

and then modal.py

    def _restore_focus(self) -> None:
        ...
        if self.app.screen.focus_chain:
            self.app.set_focus(self.app.screen.focus_chain[0])   <---
Edited by Mateusz Żebrak

Merge request reports

Loading