INNER CODE UNIT · Python
action_next_tab_and_focus
antoniorodr/cronboard · src/cronboard/app.py:230
def action_next_tab_and_focus(self) -> None:
"""Switches to the next tab and focuses the first form element."""
tabs: CronTabs = self.tabs
tab_widgets: list[Tab] = list(tabs.query(Tab))
tab_ids: list[str] = [tab.id for tab in tab_widgets]
current: str = tabs.active
index: int = tab_ids.index(current)
next_index: int = (index + 1) % len(tab_ids)
next_tab_id: str = tab_ids[next_index]
tabs.active = next_tab_id
self.show_tab_content(next_index)
self._focus_active_panel()
def _focus_active_panel(self) -> None: