feat: Allow character deletion and chip editing in BdsInputChips#1100
Draft
Copilot wants to merge 3 commits into
Draft
feat: Allow character deletion and chip editing in BdsInputChips#1100Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
|
- Changed keyPressWrapper to check nativeInput.value instead of this.value for better synchronization - Added comprehensive unit tests for character deletion scenarios - Added e2e tests to verify typing and backspace behavior works correctly - All 60 tests pass (44 unit + 16 e2e) Co-authored-by: lucasmiqueias <11753940+lucasmiqueias@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix character deletion in BdsInputChips component
Fix: Allow character deletion while typing in BdsInputChips
Oct 20, 2025
Collaborator
|
@copilot Preciso que ao usar backspace ou del quando um chip for adicionado, seja removido o chip mais o valor persista apagando apenas um texto, veja um exemplo de como pode ser feito: |
- When Backspace is pressed on empty input, move last chip content to input for editing - Delete key still removes chip without moving to input (different behavior) - Updated all unit and e2e tests to reflect new behavior - All 61 tests pass (45 unit + 16 e2e) Co-authored-by: lucasmiqueias <11753940+lucasmiqueias@users.noreply.github.com>
Contributor
Author
... Implemented as requested. When Backspace is pressed on an empty input, the last chip is now removed and its content is moved to the input field for editing, with the cursor positioned at the end. Behavior:
Commit: b4e0c43 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
Fix: Allow character deletion while typing in BdsInputChips
feat: Allow character deletion and chip editing in BdsInputChips
Oct 20, 2025
lucasmiqueias
approved these changes
Oct 20, 2025
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.
Problem
The BdsInputChips component was not allowing users to delete individual characters while typing a new chip. When pressing Backspace or Delete keys, the component would remove the entire last chip instead of allowing normal text editing within the input field.
This made it impossible to correct typos while typing - users had to delete the entire chip and retype from scratch. Additionally, there was no way to edit chips that had already been created.
Root Cause
The
keyPressWrappermethod was checkingthis.value(component state) to determine if the input was empty before removing chips. However, due to browser event timing:keydownevent fires first (wherekeyPressWrapperexecutes)inputevent fires, updatingthis.valueThis meant
this.valuecould be out of sync with the actual DOM input value when the keydown handler ran, leading to incorrect behavior.Solution
Changed the condition to check
nativeInput.value(the actual DOM input element's value) instead ofthis.value, and implemented chip editing functionality:This ensures we check the actual current state of the input field at the time of the keydown event, not the potentially stale component state.
Changes
keyPressWrapperininput-chips.tsxto usenativeInput.valuefor accurate input state checkingTesting
All 61 tests pass (45 unit + 16 e2e):
Behavior
Character deletion while typing:
Chip editing (NEW):
Fixes #1099
Original prompt
Fixes #1099
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.