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

ngModelChange fires twice on mat-chip-listbox #26942

Closed
rst2071 opened this issue Apr 15, 2023 · 2 comments · Fixed by #26963
Closed

ngModelChange fires twice on mat-chip-listbox #26942

rst2071 opened this issue Apr 15, 2023 · 2 comments · Fixed by #26963
Assignees
Labels
area: material/chips P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@rst2071
Copy link

rst2071 commented Apr 15, 2023

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

No

Description

ngModelChange on the material chip listbox is not only triggered when selecting a value, but also a second time when clicking anywhere in the browser window with the mouse.
The occurs only once and with the first mouse-click after a previous value has been selected. The thereby emitted value is the same as the previous one.
It does not occur when clicking on another chip with the next mouse-click.

Steps to reproduce:

  1. click on a chip to select a value
  2. click somewhere in the window (just not on a chip) to trigger the event a second time

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-gcasi5?file=src/app/chips-overview-example.ts

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 15.2.6
Node: 18.16.0
Package Manager: npm 9.5.1
OS: darwin x64

Angular: 15.2.7
... animations, cdk, common, compiler, compiler-cli, core, forms
... material, material-date-fns-adapter, platform-browser
... platform-browser-dynamic, router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1502.6
@angular-devkit/build-angular   15.2.6
@angular-devkit/core            15.2.6
@angular-devkit/schematics      15.2.6
@angular/cli                    15.2.6
@schematics/angular             15.2.6
rxjs                            7.8.0
typescript                      4.9.5

Anything else?

No response

@JeanMeche
Copy link
Member

Hi, you should post your issue on the components repo.

I just checked the code, the component does indeed explicitly emit a change on on blur event.

@JoostK JoostK transferred this issue from angular/angular Apr 16, 2023
@crisbeto crisbeto self-assigned this Apr 20, 2023
@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: material/chips labels Apr 20, 2023
crisbeto added a commit to crisbeto/material2 that referenced this issue Apr 20, 2023
Fixes that the chips listbox was emitting change events both when a chip is toggled and when the listbox is blurred.

Fixes angular#26942.
angular-robot bot pushed a commit that referenced this issue Apr 20, 2023
Fixes that the chips listbox was emitting change events both when a chip is toggled and when the listbox is blurred.

Fixes #26942.
angular-robot bot pushed a commit that referenced this issue Apr 20, 2023
Fixes that the chips listbox was emitting change events both when a chip is toggled and when the listbox is blurred.

Fixes #26942.

(cherry picked from commit fb9fd00)
angular-robot bot pushed a commit that referenced this issue Apr 20, 2023
Fixes that the chips listbox was emitting change events both when a chip is toggled and when the listbox is blurred.

Fixes #26942.

(cherry picked from commit fb9fd00)
@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 May 21, 2023
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.

3 participants