-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input-related FooterKeys sorted differently since Textual 1.0.0 #5412
Comments
I suspect this is because esc is also used to minimize a maximized widget. Presumably this existing 'binding' is further down the chain, so overriding this will cause it to appear last in the footer? |
It looks like this was introduced in e1bf6ff, where The multilevel inheritance seems to matter, for reasons I don't yet understand! For example, where a widget simply inherits from from textual.app import App, ComposeResult
from textual.widget import Widget
from textual.widgets import Footer
class MyWidget(Widget, can_focus=True):
BINDINGS = [
("escape", "escape", "Escape"),
("ctrl+a", "screen.maximize", "Maximize"),
]
DEFAULT_CSS = """
MyWidget {
width: auto;
height: auto;
}
"""
class ExampleApp(App):
def compose(self) -> ComposeResult:
yield MyWidget()
yield Footer()
if __name__ == "__main__":
app = ExampleApp()
app.run() Whereas a widget with multilevel inheritance and a binding for esc binding will display this last in the footer: from textual.app import App, ComposeResult
from textual.widget import Widget
from textual.widgets import Footer
class MyWidget(Widget, can_focus=True):
BINDINGS = [
("ctrl+a", "screen.maximize", "Maximize"),
]
DEFAULT_CSS = """
MyWidget {
width: auto;
height: auto;
}
"""
class SubWidget(MyWidget):
BINDINGS = [
("escape", "escape", "Escape"),
]
class ExampleApp(App):
def compose(self) -> ComposeResult:
yield SubWidget()
yield Footer()
if __name__ == "__main__":
app = ExampleApp()
app.run() |
Possibly a consequence of |
This issue affects Textual 1.0.0. It feels close to #4639.
MRE
Expected behaviour
Textual 0.89.1 behaves as expected: focusing either the
Wid
Widget or theInp
Input leads to the following FooterKeys:Encountered behaviour
Textual 1.0.0 moves the
escape
FooterKey. This happens only to theInp
Input, not to theWid
Widget:The text was updated successfully, but these errors were encountered: