Skip to content

F3 key triggered when inline and VerticalScroll takes up 100% of the screen #5805

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

Open
radiac opened this issue May 16, 2025 · 2 comments
Open

Comments

@radiac
Copy link

radiac commented May 16, 2025

I see a lot of F3 key events on the console when I have a VerticalScroll which is taking up 100% of the height of an inline app, eg:

Key(key='f3', character=None, name='f3', is_printable=False) >>> VerticalScroll() method=<Widget.on_key>
Key(key='f3', character=None, name='f3', is_printable=False) >>> Screen(id='_default') method=<Widget.on_key>
Key(key='f3', character=None, name='f3', is_printable=False) >>> MyApp(title='MyApp', classes={'-dark-mode'}, pseudo_classes={'focus', 'dark', 'inline'}) method=<App.on_key>

To recreate:

from textual.app import App, ComposeResult
from textual.containers import VerticalScroll
from textual.widgets import Button


class TestApp(App):
    def compose(self) -> ComposeResult:
        # yield Header()
        with VerticalScroll():
            yield Button("hello", id="output")


if __name__ == "__main__":
    app = TestApp()
    app.run(inline=True)

run with textual run --dev test.py and you will see f3 key events in the console; it appears they are raised each time the app gains or loses focus, or redraws.

Uncomment the Header, run with inline=False, or set a css height under 100% and they stop appearing.

Copy link

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

@TomJGooding
Copy link
Contributor

TomJGooding commented May 18, 2025

If you're running in inline mode, presumably you wouldn't want the app to take up the full screen anyway? Adding a max-height to the screen seems to fix this issue:

    CSS = """
    Screen:inline {
        max-height: 97vh;
    }
    """

Running this in debug mode, it looks like it is the cursor position that's being misinterpreted as a F3 key press.

I don't quite understand why, but I'm guessing related to the screen height being auto in inline mode? From a quick git bisect, it looks like this was introduced in 80175f0, if it helps someone figure this out!

Extract from keys.log
FEED '\x1b[1;1R\x1b[1;1R\x1b[1;1R'
character='\x1b'
sequence='\x1b['
sequence='\x1b[1'
sequence='\x1b[1;'
sequence='\x1b[1;1'
sequence='\x1b[1;1R'
Key(key='f3', character=None, name='f3', is_printable=False)
character='\x1b'
sequence='\x1b['
sequence='\x1b[1'
sequence='\x1b[1;'
sequence='\x1b[1;1'
sequence='\x1b[1;1R'
Key(key='f3', character=None, name='f3', is_printable=False)
character='\x1b'
sequence='\x1b['
sequence='\x1b[1'
sequence='\x1b[1;'
sequence='\x1b[1;1'
sequence='\x1b[1;1R'
Key(key='f3', character=None, name='f3', is_printable=False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants