fix: stop Enter propagation when transitioning to Input steps in appl…#34
Merged
Merged
Conversation
…y TUI
In OpenTUI's emitWithPriority, global listeners run first and renderable
handlers are captured into an array afterwards. When handleKeys (a global
listener) called showStep('name') or showStep('personality_custom'), the
new Input widget was immediately focused inside showStep, registering its
keypress handler before the renderable snapshot was taken. The same Enter
keypress that triggered the transition was then delivered to the fresh
Input, which instantly submitted an empty value and skipped the step.
Fix: call key.stopPropagation() after showStep() for the two transitions
that create an Input widget (searching→name and personality→personality_custom),
preventing the triggering Enter from reaching the newly-focused Input.
Author
|
Fix: Stop Enter key propagation when transitioning to Input steps Problem When the user presses Enter to advance from the searching step to the name step (or from the personality selector to the personality_custom step), the same Enter keypress was being delivered to the newly-focused Input Solution Call key.stopPropagation?.() after calling showStep() for transitions that land on an Input step. This prevents the triggering Enter event from bubbling into the newly-focused widget. The fix is guarded with optional chaining (?.) so it degrades gracefully if the event object doesn't support stopPropagation. Changes
|
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.
…y TUI
In OpenTUI's emitWithPriority, global listeners run first and renderable handlers are captured into an array afterwards. When handleKeys (a global listener) called showStep('name') or showStep('personality_custom'), the new Input widget was immediately focused inside showStep, registering its keypress handler before the renderable snapshot was taken. The same Enter keypress that triggered the transition was then delivered to the fresh Input, which instantly submitted an empty value and skipped the step.
Fix: call key.stopPropagation() after showStep() for the two transitions that create an Input widget (searching→name and personality→personality_custom), preventing the triggering Enter from reaching the newly-focused Input.