Skip to content

Input-related FooterKeys sorted differently since Textual 1.0.0 #5412

Open
@xavierog

Description

@xavierog

This issue affects Textual 1.0.0. It feels close to #4639.

MRE

from textual.app import App
from textual.binding import Binding
from textual.widget import Widget
from textual.widgets import Footer, Input

class Wid(Widget, can_focus=True):
    BINDINGS = [
        ('escape', 'escape', 'Widget Escape'),
        ('up', 'up', 'Widget Up'),
        ('down', 'down', 'Widget Down'),
    ]
    DEFAULT_CSS = "Wid { max-height: 5; }"

class Inp(Input):
    BINDINGS = [
        ('escape', 'escape', 'Input Escape'),
        ('up', 'up', 'Input Up'),
        ('down', 'down', 'Input Down'),
    ]

class MRE(App):
    def compose(self):
        yield Wid()
        yield Inp()
        yield Footer()

if __name__ == '__main__':
    app = MRE()
    app.run()

Expected behaviour

Textual 0.89.1 behaves as expected: focusing either the Wid Widget or the Inp Input leads to the following FooterKeys:

 esc Input Escape  ↑ Input Up  ↓ Input Down
 esc Widget Escape  ↑ Widget Up  ↓ Widget Down

Encountered behaviour

Textual 1.0.0 moves the escape FooterKey. This happens only to the Inp Input, not to the Wid Widget:

 ↑ Input Up  ↓ Input Down  esc Input Escape
 esc Widget Escape  ↑ Widget Up  ↓ Widget Down

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions