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

MultiSelect: touched form property doesn't respect updateOn blur #14780

Closed
jonmarozick opened this issue Feb 9, 2024 · 5 comments · Fixed by #16573
Closed

MultiSelect: touched form property doesn't respect updateOn blur #14780

jonmarozick opened this issue Feb 9, 2024 · 5 comments · Fixed by #16573
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@jonmarozick
Copy link

jonmarozick commented Feb 9, 2024

Describe the bug

When I use the p-multiSelect in a formGroup and set the updateOn to blur, I would expect the touched property to remain false until I've click outside of the p-multiSelect component and the overlay closes.

In the source, the 2 places I see onModelTouched are in onOverlayAnimationStart and onInputBlur

I tried to debug a little with StackBlitz using preventModelTouched to see how the onInputBlur was behaving. I also dump the AnimationEvent to see when the visible and void states occur.

My goal is to allow a user to make a selection without validation being presented until the user is done making selections. Presumably, that's on blur.

Environment

Windows 10, Edge Version 121.0.2277.106 (Official build) (64-bit)

Reproducer

https://stackblitz.com/edit/stackblitz-starters-hu8uwy?file=src%2Fmain.ts

Angular version

17.1.2, 16.2.12

PrimeNG version

17.6.0, 16.9.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.16.0

Browser(s)

No response

Steps to reproduce the behavior

Click the Select A Make p-multiSelect dropdown and don't click anywhere else. The touched line turns from false to true immediately after clicking.

Expected behavior

On page load the touched value is false. When I click the p-multiSelect I expect touched to remain false. Then, when I click outside the p-multiSelect I expect touched to be true.

@jonmarozick jonmarozick added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 9, 2024
@jonmarozick
Copy link
Author

jonmarozick commented Feb 10, 2024

I made another StackBlitz with the same exact code but using Angular 14.3.0 and PrimeNG 14.2.3 that shows the same exact code working properly.

@cetincakiroglu cetincakiroglu added this to the 17.7.0 milestone Feb 12, 2024
@cetincakiroglu
Copy link
Contributor

Hi,

Could you please replace the app link by editable link?

@cetincakiroglu cetincakiroglu added the Resolution: Needs More Information More information about the issue is needed to find a correct solution label Feb 12, 2024
@jonmarozick
Copy link
Author

jonmarozick commented Feb 12, 2024

Sorry about that. I was going to fast and clicked the wrong copy button

@cetincakiroglu
Copy link
Contributor

Hi,

Thanks for the example, we'll investigate the behavior. Changing the milestone to 17.8.0 because it'll take time to identify the source of the defect and provide a solution without any breaking change.

@cetincakiroglu cetincakiroglu modified the milestones: 17.7.0, 17.8.0 Feb 14, 2024
@cetincakiroglu cetincakiroglu removed the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 14, 2024
@cetincakiroglu cetincakiroglu modified the milestones: 17.8.0, 17.9.0, 17.Future Feb 23, 2024
@SchleichAlex
Copy link

Hi, this bug was introduced with commit-id: 0cdb8bd for version 16.7.0
The break in the first case of the switch was removed which leads to a fall-through to the second case which instantly calls the onModelTouched function

16.6.0: image
16.7.0: image

@mehmetcetin01140 mehmetcetin01140 added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Nov 12, 2024
@mehmetcetin01140 mehmetcetin01140 modified the milestones: 18.Future, 17.18.12 Nov 12, 2024
@mehmetcetin01140 mehmetcetin01140 removed the Resolution: Needs More Information More information about the issue is needed to find a correct solution label Nov 12, 2024
mehmetcetin01140 added a commit that referenced this issue Nov 12, 2024
Fix #14780 - Fix multiselect instantly call onModelTouched
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants