Repository navigation
Handle Tab key in readonly TextInput and NumberInput on GTK - #4779
Open
100jinwoo001 wants to merge 5 commits into
Open
100jinwoo001 wants to merge 5 commits into
100jinwoo001 wants to merge 5 commits into
Conversation
Member
|
Is this intentionally still in draft status? It seems to be passing CI, so it's unclear if you're planning to do more work here. |
100jinwoo001
marked this pull request as ready for review
November 3, 2026 12:24
freakboy3742
requested changes
Nov 9, 2026
freakboy3742
left a comment
Member
There was a problem hiding this comment.
This is a relatively straightforward fix; the problem with the PR is that it is untested.
This won't show up as a coverage gap because there's no "branch" involved here - we need to add a testbed case for giving focus to a readonly widget (gated on whether each platform allows a readonly widget to accept focus).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes #2554 by intercepting the Tab and Shift+Tab keys when a
TextInputorNumberInputis inreadonlymode on GTK:Gtk.Entry(andGtk.SpinButton) emitsgtk_widget_error_bell(system beep) when a key that would insert a character (like\t) is received whileeditableisFalse.gtk/src/toga_gtk/widgets/textinput.pyandgtk/src/toga_gtk/widgets/numberinput.py, when the widget isreadonlyandKey.TABis pressed:Gtk.DirectionType.TAB_FORWARD) or previous (Gtk.DirectionType.TAB_BACKWARD) widget viatoplevel.child_focus(GTK3) /root.child_focus(GTK4).Trueso the event is marked handled, preventingGtk.Entry's default text insertion handler from triggering the error bell.changes/2554.bugfix.md.Under GTK, if a readonly text input loses focus as a result of keyboard input (pressing Tab), a system beep was emitted because
GtkEntrytreated Tab as an unhandled edit attempt before propagating focus.Fixes #2554
PR Checklist:
Assisted-by: ChatGPT