Skip to content

Commit 469200a

Browse files
committed
Fix CanFocusWithScrollbarsOnly
It stopped working behaving correctly after 2.0.0: Textualize/textual#5605 Still there is a know issue: Textualize/textual#5609
1 parent e3a13a3 commit 469200a

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

clive/__private/ui/screens/operations/governance_operations/common_governance/governance_actions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def compose(self) -> ComposeResult:
8686
yield Static("Action", id="action-row")
8787
yield Static(self.NAME_OF_ACTION, id="action-name-row")
8888

89-
async def on_mount(self) -> None: # type: ignore[override]
89+
async def on_mount(self) -> None:
9090
await self.mount_operations_from_cart()
9191

9292
async def add_row(self, identifier: str, *, vote: bool = False, pending: bool = False) -> None:

clive/__private/ui/widgets/scrolling.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,9 @@ class CanFocusWithScrollbarsOnly(CliveWidget, AbstractClassMessagePump):
1313
Inherit from this class to make a widget focusable only when any scrollbar is active.
1414
"""
1515

16-
def on_mount(self) -> None:
17-
self.__enable_focus_only_when_scrollbar_is_active()
18-
19-
def watch_show_vertical_scrollbar(self) -> None:
20-
self.__enable_focus_only_when_scrollbar_is_active()
21-
22-
def watch_show_horizontal_scrollbar(self) -> None:
23-
self.__enable_focus_only_when_scrollbar_is_active()
24-
25-
def __enable_focus_only_when_scrollbar_is_active(self) -> None:
26-
self.can_focus = any(self.scrollbars_enabled)
16+
def allow_focus(self) -> bool:
17+
# Known issue: https://github.com/Textualize/textual/issues/5609
18+
return any(self.scrollbars_enabled)
2719

2820

2921
class ScrollablePartFocusable(VerticalScroll, CanFocusWithScrollbarsOnly):

0 commit comments

Comments
 (0)