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

Angular form field having max length reached makes a call to form.valuechanges() when we try to append a string by pasting something in it. #43228

Open
vijaymsit88 opened this issue Aug 23, 2021 · 1 comment · May be fixed by #55761
Labels
area: forms P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Milestone

Comments

@vijaymsit88
Copy link

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

forms

Is this a regression?

No

Description

Steps to repro:

  1. Create a reactive form with an input type = "text" html field with maxlength = 10.
  2. Enter "abcdefghij" in this input field.
  3. While keeping the cursor at the end in this field, try to append by copy pasting "xyz" to the end.
  4. Form valuechanges() gets called, but there is no visible change (as maxlength attribute is restricting appending)
  5. Same does not happen when we try to directly type in and append "xyz".

Because of this valuechanges() getting called Validations are triggering and causing issues for us.

Refer to demo I am using Angular sample Form app, refer to the behavior of field "firstname" in Profile Editor component.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-jn6sll?file=src%2Fapp%2Fprofile-editor%2Fprofile-editor.component.ts

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

No response

Anything else?

No response

@ngbot ngbot bot added this to the needsTriage milestone Aug 23, 2021
@dylhunn
Copy link
Contributor

dylhunn commented Jan 28, 2022

This is something we'd love to fix, but it's possibly breaking. We'd need a PR to run a presubmit on to asses the scope of the breakage.

@alxhub alxhub added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Nov 16, 2022
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Nov 16, 2022
JeanMeche added a commit to JeanMeche/angular that referenced this issue May 11, 2024
In case an input event sends the same value to our forms, we will discard the update and consider the input hasn't change. This will prevent having duplicate values on the valueChanges event.

Fixes angular#43228
JeanMeche added a commit to JeanMeche/angular that referenced this issue May 11, 2024
In case an input event sends the same value to our forms, we will discard the update and consider the input hasn't change. This will prevent having duplicate values on the valueChanges event.

Fixes angular#43228
JeanMeche added a commit to JeanMeche/angular that referenced this issue May 11, 2024
In case an input event sends the same value to our forms, we will discard the update and consider the input hasn't change. This will prevent having duplicate values on the valueChanges event.

Fixes angular#43228
JeanMeche added a commit to JeanMeche/angular that referenced this issue May 11, 2024
In case an input event sends the same value to our forms, we will discard the update and consider the input hasn't change. This will prevent having duplicate values on the valueChanges event.

Fixes angular#43228
JeanMeche added a commit to JeanMeche/angular that referenced this issue May 11, 2024
In case an input event sends the same value to our forms, we will discard the update and consider the input hasn't change. This will prevent having duplicate values on the valueChanges event.

Fixes angular#43228
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: forms 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.

4 participants