Skip to content

Commit c0e3d69

Browse files
committed
Merge branch 'main' of github.com:Textualize/textual into themes
2 parents 2da1f4c + 4182ad4 commit c0e3d69

File tree

5 files changed

+208
-31
lines changed

5 files changed

+208
-31
lines changed

.github/workflows/pythonpackage.yml

-11
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,6 @@ jobs:
2121
matrix:
2222
os: [ubuntu-latest, windows-latest, macos-latest]
2323
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
24-
25-
# Python 3.9 is on macos-13 but not macos-latest (macos-14-arm64)
26-
# https://github.com/actions/setup-python/issues/696#issuecomment-1637587760
27-
exclude:
28-
- { python-version: "3.8", os: "macos-latest" }
29-
- { python-version: "3.9", os: "macos-latest" }
30-
- { python-version: "3.11", os: "macos-latest" }
31-
include:
32-
- { python-version: "3.8", os: "macos-13" }
33-
- { python-version: "3.9", os: "macos-13" }
34-
- { python-version: "3.11", os: "macos-13" }
3524
defaults:
3625
run:
3726
shell: bash

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## Unreleased
9+
10+
### Fixed
11+
12+
- Fixed `RadioSet` not being scrollable https://github.com/Textualize/textual/issues/5100
13+
814
## [0.83.0] - 2024-10-10
915

1016
### Added

src/textual/widgets/_radio_set.py

+15-10
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99

1010
from textual import _widget_navigation
1111
from textual.binding import Binding, BindingType
12-
from textual.containers import Container
12+
from textual.containers import VerticalScroll
1313
from textual.events import Click, Mount
1414
from textual.message import Message
1515
from textual.reactive import var
1616
from textual.widgets._radio_button import RadioButton
1717

1818

19-
class RadioSet(Container, can_focus=True, can_focus_children=False):
19+
class RadioSet(VerticalScroll, can_focus=True, can_focus_children=False):
2020
"""Widget for grouping a collection of radio buttons into a set.
2121
2222
When a collection of [`RadioButton`][textual.widgets.RadioButton]s are
@@ -33,17 +33,17 @@ class RadioSet(Container, can_focus=True, can_focus_children=False):
3333
height: auto;
3434
width: auto;
3535
36+
& > RadioButton {
37+
background: transparent;
38+
border: none;
39+
padding: 0 1;
40+
}
41+
3642
& > RadioButton.-selected {
3743
color: $text;
3844
background: $highlight-cursor-blurred;
3945
}
4046
41-
& > * {
42-
background: transparent;
43-
border: none;
44-
padding: 0;
45-
}
46-
4747
& .toggle--button {
4848
color: $surface;
4949
background: $foreground 15%;
@@ -84,8 +84,6 @@ class RadioSet(Container, can_focus=True, can_focus_children=False):
8484
}
8585
}
8686
}
87-
88-
8987
"""
9088

9189
BINDINGS: ClassVar[list[BindingType]] = [
@@ -215,6 +213,7 @@ def watch__selected(self) -> None:
215213
self.query(RadioButton).remove_class("-selected")
216214
if self._selected is not None:
217215
self._nodes[self._selected].add_class("-selected")
216+
self._scroll_to_selected()
218217

219218
def _on_radio_button_changed(self, event: RadioButton.Changed) -> None:
220219
"""Respond to the value of a button in the set being changed.
@@ -303,3 +302,9 @@ def action_toggle_button(self) -> None:
303302
button = self._nodes[self._selected]
304303
assert isinstance(button, RadioButton)
305304
button.toggle()
305+
306+
def _scroll_to_selected(self) -> None:
307+
"""Ensure that the selected button is in view."""
308+
if self._selected is not None:
309+
button = self._nodes[self._selected]
310+
self.call_after_refresh(self.scroll_to_widget, button, animate=False)

0 commit comments

Comments
 (0)