You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
8
8
## Unreleased
9
9
10
+
### Added
11
+
12
+
- Added `PRIORITY_BINDINGS` class variable, which can be used to control if a widget's bindings have priority by default. https://github.com/Textualize/textual/issues/1343
13
+
14
+
### Changed
15
+
16
+
- Renamed the `Binding` argument `universal` to `priority`. https://github.com/Textualize/textual/issues/1343
17
+
- When looking for bindings that have priority, they are now looked from `App` downwards. https://github.com/Textualize/textual/issues/1343
18
+
-`BINDINGS` on an `App`-derived class have priority by default. https://github.com/Textualize/textual/issues/1343
19
+
-`BINDINGS` on a `Screen`-derived class have priority by default. https://github.com/Textualize/textual/issues/1343
20
+
10
21
### Fixed
11
22
12
23
- Fixed validator not running on first reactive set https://github.com/Textualize/textual/pull/1359
Copy file name to clipboardExpand all lines: docs/guide/input.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -127,6 +127,15 @@ Note how the footer displays bindings and makes them clickable.
127
127
Multiple keys can be bound to a single action by comma-separating them.
128
128
For example, `("r,t", "add_bar('red')", "Add Red")` means both ++r++ and ++t++ are bound to `add_bar('red')`.
129
129
130
+
131
+
!!! note
132
+
133
+
Ordinarily a binding on a focused widget has precedence over the same key binding at a higher level. However, bindings at the `App` or `Screen` level always have priority.
134
+
135
+
The priority of a single binding can be controlled with the `priority` parameter of a `Binding` instance. Set it to `True` to give it priority, or `False` to not.
136
+
137
+
The default priority of all bindings on a class can be controlled with the `PRIORITY_BINDINGS` class variable. Set it to `True` or `False` to set the default priroty for all `BINDINGS`.
138
+
130
139
### Binding class
131
140
132
141
The tuple of three strings may be enough for simple bindings, but you can also replace the tuple with a [Binding][textual.binding.Binding] instance which exposes a few more options.
0 commit comments