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

Mask editor incorrect ControlValueAccessor implementation #6783

Closed
damyanpetev opened this issue Feb 19, 2020 · 0 comments · Fixed by #6455
Closed

Mask editor incorrect ControlValueAccessor implementation #6783

damyanpetev opened this issue Feb 19, 2020 · 0 comments · Fixed by #6455
Assignees
Labels
🐛 bug Any issue that describes a bug 🧨 severity: medium mask-editor version: 9.1.x ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.

Comments

@damyanpetev
Copy link
Member

Description

The mask editor causes the model to become dirty even before user interaction, showing invalid styling before the user interacts with the control. This is because the writeValue also circles back the value to the model:

public writeValue(value) {
if (this.promptChar && this.promptChar.length > 1) {
this._maskOptions.promptChar = this.promptChar.substring(0, 1);
}
this.value = value ? this.maskParser.parseValueByMaskOnInit(value, this._maskOptions) : '';
if (this.displayValuePipe) {
this.value = this.displayValuePipe.transform(this.value);
}
this.dataValue = this.includeLiterals ? this.value : value;
this._onChangeCallback(this.dataValue);

Also if updateOn: 'blur' is used the mask never notifies the model (_onTouchedCallback not called on blur) and thus value changes are never committed.

  • igniteui-angular version: 9.0.2
  • browser: N/A

Steps to reproduce

  1. Open https://stackblitz.com/edit/mask-value-accessor
  2. Observe the state of the first mask editor
  3. Fill in the second and blur

Result

First mask editor loads up initially with invalid visual indication (red) and the model is marked as dirty:
image

The second editor even after filling up the value, remains in error style and the model is never updated:
image

Expected result

This first editor should not dirty flag the model on init and the second editor should correctly update the model value on blur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Any issue that describes a bug 🧨 severity: medium mask-editor version: 9.1.x ✅ status: resolved Applies to issues that have pending PRs resolving them, or PRs that have already merged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants