Skip to content
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

bug(MatChipInput): On press Backspace button input value added to chips #23128

Closed
akirpichnikov opened this issue Jul 7, 2021 · 1 comment · Fixed by #23136
Closed

bug(MatChipInput): On press Backspace button input value added to chips #23128

akirpichnikov opened this issue Jul 7, 2021 · 1 comment · Fixed by #23136
Assignees
Labels
area: material/chips P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@akirpichnikov
Copy link

akirpichnikov commented Jul 7, 2021

Reproduction

Stackblitz with Angular 12.1.1 incorrect behavior: https://stackblitz.com/edit/angular-zb5iff?file=src/app/chips-input-example.html
Stackblitz with Angular 11.x.x and correct behavior: https://stackblitz.com/edit/angular-sehgsv?file=src/app/chips-input-example.html

Steps to reproduce:

  1. Click on any chip (or press add text button)
  2. Value added to input field and input focused
  3. Press Backspace button

User may press any other button like cursor keys, delete and after that backspace behave correctly.

Expected Behavior

Delete the last character in the input field

Actual Behavior

Chip immediately added to chips with the current value

Environment

  • Angular: 12.1.1
  • CDK/Material: 12.1.1
  • Browser(s): Chrome 91.0.4472.114, Firefox 89.0.2
  • Operating System (Windows 10, macOS 11.4):
@akirpichnikov akirpichnikov added the needs triage This issue needs to be triaged by the team label Jul 7, 2021
@crisbeto crisbeto added area: material/chips P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed needs triage This issue needs to be triaged by the team labels Jul 7, 2021
@crisbeto crisbeto self-assigned this Jul 8, 2021
@crisbeto crisbeto added the has pr label Jul 8, 2021
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 8, 2021
…pace

In angular#19700 a flag was introduced whose purpose was to indicate whether focus should be moved from the input to the chips when pressing backspace. The problem is that the flag was only being updated on key presses and on init which means that the state will be incorrect if the value changes programmatically after init.

Fixes angular#23128.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 9, 2021
…pace

In angular#19700 a flag was introduced whose purpose was to indicate whether focus should be moved from the input to the chips when pressing backspace. The problem is that the flag was only being updated on key presses and on init which means that the state will be incorrect if the value changes programmatically after init.

Fixes angular#23128.
wagnermaciel pushed a commit that referenced this issue Jul 13, 2021
…pace (#23136)

In #19700 a flag was introduced whose purpose was to indicate whether focus should be moved from the input to the chips when pressing backspace. The problem is that the flag was only being updated on key presses and on init which means that the state will be incorrect if the value changes programmatically after init.

Fixes #23128.
wagnermaciel pushed a commit that referenced this issue Jul 13, 2021
…pace (#23136)

In #19700 a flag was introduced whose purpose was to indicate whether focus should be moved from the input to the chips when pressing backspace. The problem is that the flag was only being updated on key presses and on init which means that the state will be incorrect if the value changes programmatically after init.

Fixes #23128.

(cherry picked from commit 6a6712d)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/chips P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants