mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Fix :focus-within pseudo-selector (#885)
* Fix :focus-within pseudo-selector * Remove debug prints
This commit is contained in:
@@ -424,7 +424,6 @@ class Stylesheet:
|
||||
|
||||
# Calculate replacement rules (defaults + new rules)
|
||||
new_styles = Styles(node, rules)
|
||||
|
||||
if new_styles == base_styles:
|
||||
# Nothing to change, return early
|
||||
return
|
||||
|
||||
@@ -52,7 +52,6 @@ if TYPE_CHECKING:
|
||||
ScrollUp,
|
||||
)
|
||||
|
||||
|
||||
_JUSTIFY_MAP: dict[str, JustifyMethod] = {
|
||||
"start": "left",
|
||||
"end": "right",
|
||||
@@ -1889,22 +1888,16 @@ class Widget(DOMNode):
|
||||
self.refresh()
|
||||
|
||||
def _on_descendant_focus(self, event: events.DescendantFocus) -> None:
|
||||
self.descendant_has_focus = True
|
||||
if "focus-within" in self.pseudo_classes:
|
||||
sender = event.sender
|
||||
for child in self.walk_children(False):
|
||||
child.refresh()
|
||||
if child is sender:
|
||||
break
|
||||
if not self.descendant_has_focus:
|
||||
self.descendant_has_focus = True
|
||||
|
||||
def _on_descendant_blur(self, event: events.DescendantBlur) -> None:
|
||||
self.descendant_has_focus = False
|
||||
if self.descendant_has_focus:
|
||||
self.descendant_has_focus = False
|
||||
|
||||
def watch_descendant_has_focus(self, value: bool) -> None:
|
||||
if "focus-within" in self.pseudo_classes:
|
||||
sender = event.sender
|
||||
for child in self.walk_children(False):
|
||||
child.refresh()
|
||||
if child is sender:
|
||||
break
|
||||
self.app._require_stylesheet_update.add(self)
|
||||
|
||||
def _on_mouse_scroll_down(self, event) -> None:
|
||||
if self.allow_vertical_scroll:
|
||||
|
||||
Reference in New Issue
Block a user