Describe the bug
On all platforms, when the content of a ScrollContainer has a minimum size in a non-scrollable direction (e.g. a widget with minimum width as the content of a horizontally non-scrollable ScrollContainer), the ScrollContainer is still allowed to shrink in the nonscrollable axis beyond a size necessary to present the content.
How to reproduce the bug
- Run the example code
- See how you can shrink the window beyond 500px which is the minimum size of the content.
Minimum example code
import toga
from toga.style import Pack
from toga.style.pack import COLUMN
class ScrollTest(toga.App):
def startup(self):
content = toga.Box()
content.width = 500
content.background_color = "magenta"
scroll = toga.ScrollContainer(
horizontal=False, # disable horizontal scrolling
vertical=True,
content=content,
style=Pack(flex=1),
)
self.main_window = toga.MainWindow(title=self.formal_name)
self.main_window.content = scroll
self.main_window.show()
ScrollTest('1', '2.3').main_loop()
Screenshots
Shrinked window:
Actual minimum size of content:
Environment details
- Operating system and version: macOS 26.3.1
- Python version: Python 3.13.0
- Software versions:
Logs
No response
Additional context
I believe that the fix will be in the rehint() of each backend.
The two different scrollbars will interact with the minimum sizing, so that must be handled properly.
On macOS, opaque scrollbars may be shown at all times through a setting, which can be changed at runtime; that must be handled appropriately, even though macOS usually uses a translucent scrollbar.
Describe the bug
On all platforms, when the content of a ScrollContainer has a minimum size in a non-scrollable direction (e.g. a widget with minimum width as the content of a horizontally non-scrollable ScrollContainer), the ScrollContainer is still allowed to shrink in the nonscrollable axis beyond a size necessary to present the content.
How to reproduce the bug
Minimum example code
import toga from toga.style import Pack from toga.style.pack import COLUMN class ScrollTest(toga.App): def startup(self): content = toga.Box() content.width = 500 content.background_color = "magenta" scroll = toga.ScrollContainer( horizontal=False, # disable horizontal scrolling vertical=True, content=content, style=Pack(flex=1), ) self.main_window = toga.MainWindow(title=self.formal_name) self.main_window.content = scroll self.main_window.show() ScrollTest('1', '2.3').main_loop()Screenshots
Shrinked window:
Actual minimum size of content:
Environment details
Logs
No response
Additional context
I believe that the fix will be in the rehint() of each backend.
The two different scrollbars will interact with the minimum sizing, so that must be handled properly.
On macOS, opaque scrollbars may be shown at all times through a setting, which can be changed at runtime; that must be handled appropriately, even though macOS usually uses a translucent scrollbar.