File tree Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Expand file tree Collapse file tree 4 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/ )
6
6
and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
7
7
8
+ ## Unreleased
9
+
10
+ - Fixed broken focus-within https://github.com/Textualize/textual/issues/5184
11
+
8
12
## [ 0.85.1] - 2024-10-26
9
13
10
14
### Fixed
Original file line number Diff line number Diff line change @@ -762,8 +762,8 @@ def __init__(
762
762
perform work after the app has resumed.
763
763
"""
764
764
765
- self .set_class (self .dark , "-dark-mode" )
766
- self .set_class (not self .dark , "-light-mode" )
765
+ self .set_class (self .dark , "-dark-mode" , update = False )
766
+ self .set_class (not self .dark , "-light-mode" , update = False )
767
767
768
768
self .animation_level : AnimationLevel = constants .TEXTUAL_ANIMATIONS
769
769
"""Determines what type of animations the app will display.
Original file line number Diff line number Diff line change @@ -433,13 +433,14 @@ def _check_rule(
433
433
if _check_selectors (selector_set .selectors , css_path_nodes ):
434
434
yield selector_set .specificity
435
435
436
- # pseudo classes which iterate over many nodes
437
- # these have the potential to be slow, and shouldn't be used in a cache key
438
- EXPENSIVE_PSEUDO_CLASSES = {
436
+ # pseudo classes which iterate over multiple nodes
437
+ # These shouldn't be used in a cache key
438
+ EXCLUDE_PSEUDO_CLASSES = {
439
439
"first-of-type" ,
440
440
"last-of_type" ,
441
441
"odd" ,
442
442
"even" ,
443
+ "focus-within" ,
443
444
}
444
445
445
446
def apply (
@@ -487,7 +488,7 @@ def apply(
487
488
cache_key : tuple | None = None
488
489
489
490
if cache is not None and all_pseudo_classes .isdisjoint (
490
- self .EXPENSIVE_PSEUDO_CLASSES
491
+ self .EXCLUDE_PSEUDO_CLASSES
491
492
):
492
493
cache_key = (
493
494
node ._parent ,
Original file line number Diff line number Diff line change @@ -210,6 +210,8 @@ def __init__(
210
210
211
211
self .label = label
212
212
self .variant = variant
213
+ self .set_reactive (Button .variant , variant )
214
+ self .add_class (f"-{ variant } " , update = False )
213
215
self .action = action
214
216
self .active_effect_duration = 0.2
215
217
"""Amount of time in seconds the button 'press' animation lasts."""
You can’t perform that action at this time.
0 commit comments