Fix: double-click + backspace clears only one char in text inputs#189
Open
StephaneDelcroix wants to merge 1 commit intomainfrom
Open
Fix: double-click + backspace clears only one char in text inputs#189StephaneDelcroix wants to merge 1 commit intomainfrom
StephaneDelcroix wants to merge 1 commit intomainfrom
Conversation
Change @onkeydown to @onkeyup on value-bound text inputs (session name, rename, worktree branch/PR). @onkeydown triggers a Blazor re-render before the browser processes the keystroke, which writes back element.value and clears the text selection. @onkeyup fires after the browser's default action, preserving selection behavior. Affected inputs: - CreateSessionForm.razor: session name, worktree branch, worktree PR - SessionListItem.razor: rename input - SessionCard.razor: rename input Adds InputSelectionTests.cs with convention tests to prevent regression. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Bug
When creating a new session, double-clicking the session name entry selects the full name, but pressing backspace only clears one character instead of the full selection. Same issue in rename inputs.
Root Cause
@onkeydownon value-bound inputs triggers a Blazor re-render before the browser processes the keystroke. The re-render writes backelement.value, which clears the browser's text selection. When backspace then fires, there's no selection to delete — only one character is removed.Fix
Change
@onkeydownto@onkeyupon all value-bound text inputs.@onkeyupfires after the browser's default action, so the selection is preserved and multi-character delete works correctly.Affected inputs:
CreateSessionForm.razor: session name, worktree branch, worktree PRSessionListItem.razor: rename inputSessionCard.razor: rename inputNon-value-bound inputs (Dashboard/SessionSidebar group name inputs) are unaffected and left unchanged.
Tests
Added
InputSelectionTests.cswith:@onkeydown(prevents regression)@onkeyup