Closed TomJGooding closed 1 month ago
Can confirm this one, Textual 0.73.0.
E.g. here's a data without any scroll bars
If I resize the window by decreasing its width until horizontal scroll bar appears, then vertical scroll bar appears as well, even though there's enough room for the full table height:
This looks like possibly an issue with how the base ScrollView
handles the size with the scrollbars, rather than just the DataTable
widget.
Here's another example with a Log
widget where the height is set to auto:
This probably isn't the correct fix, but this simple change to ScrollView.get_content_height
seems to work:
- return self.virtual_size.height
+ return self.virtual_size.height + self.scrollbar_size_horizontal
@TomJGooding I think that may actually be the fix. It's probably a fair assumption that when height: auto
in a ScrollView
we don't want scrollbars to sit on top of content, so we need to add that extra leeway of + self.scrollbar_size_horizontal
to make room for it in the content area. I'm guessing the same change would be required for the scrollbar on the other axis too.
@willmcgugan any thoughts?
@darrenburns Can confirm that this is an issue with the vertical scrollbar as well. Additionally, the guide makes it seem that the width of the scrollbar is accounted for – namely the two lines here
# Crop the strip so that is covers the visible area
strip = strip.crop(scroll_x, scroll_x + self.size.width)
The PR above implements those changes. Not to get_content_width
, but at a slightly lower level.
It fixes the MRE, and no tests broke!
correction one test broke, but it made it better!
@willmcgugan I can confirm this fixes the issue in my use case. Thanks!
Don't forget to star the repository!
Follow @textualizeio for Textual updates.
I haven't yet started digging into this, but I discovered a possible bug with the
DataTable
height when there is a horizontal scrollbar. If you run my quick example app below, the row is obscured by the scrollbar: