Skip to content

Commit d92c252

Browse files
committed
Make it clear, in the code, that all containers are considered scrollable
The code is exactly the same between is_container and is_scrollable, and the intent (confirmed in Textualize#1343 (comment)) is that the latter is intended to be overridden in some circumstances (so far only in `ScrollView`). As such I feel it better conveys intent and reduces the changes of mismatched future changes if is_scrollable is defined in respect to is_container. The only possible reason I can think of is if there's a measurable performance win here. Applying Knuth for the moment, at least for the scope of this PR. I strongly suspect this is one of the 97% rather than one of the 3% and for the purposes of moving stuff around (which I may be doing as I explore this) I believe this makes it easier to follow and to think about.
1 parent b48acc0 commit d92c252

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/textual/widget.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,7 @@ def is_scrollable(self) -> bool:
12271227
Returns:
12281228
bool: True if this widget may be scrolled.
12291229
"""
1230-
return self.styles.layout is not None or bool(self.children)
1230+
return self.is_container
12311231

12321232
@property
12331233
def layer(self) -> str:

0 commit comments

Comments
 (0)