Repository navigation
Conversation
A character that equals a literal of the mask was dropped from the raw value and from a value set from code, wherever it was. With the mask `+1 (000) 000-0000` the typed `5551234567` gave the value `555234567`. A text with the mask, which has the mask length and each literal in its place, is now read by position. Any other value is a raw value. Also move the changelog entries for the prompt character fix (#17817) to 22.3.3, as 22.3.2 is released, and drop a doubled blank line. Closes #17816 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A raw value with an astral character and the length of the mask was taken for a text with the mask and split by UTF-16 code unit, so the character took two positions. With the mask `CCC` the value `😀a` was shown as `__a` and not as `_a_`. A text with the mask has no half of an astral character in an editable position, as the mask never writes one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
10 tasks done
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the mask literal-position backport.
No open issues 🎉
What changed in this PR
Ports the mask literal-position fix to 22.3.x, preserving input characters that match literals and advancing parity with igc-mask-input.
Changes:
- Identifies literals by position and distinguishes fully masked text from raw values.
- Adds regression coverage for literal preservation, refocusing, and astral characters.
- Documents the behavior change and moves applicable release notes to
22.3.3.
| File | Description |
|---|---|
| projects/igniteui-angular/directives/src/directives/mask/README.md | Explains positional literals and raw-value handling. |
| projects/igniteui-angular/directives/src/directives/mask/mask.directive.spec.ts | Tests typed-value preservation across refocusing. |
| projects/igniteui-angular/directives/src/directives/mask/mask-parsing.service.ts | Implements positional literal detection and parsing. |
| projects/igniteui-angular/directives/src/directives/mask/mask-parsing.service.spec.ts | Covers raw, masked, partial, and astral input cases. |
| CHANGELOG.md | Adds 22.3.3 notes and relocates prior prompt-character fixes. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17816
Description
MaskParsingService: a literal of the mask is told by its position and not by its value.parseValueFromMaskskips only the characters at the literal positions. Before, it removed every character that equals a literal, wherever it was.applyMaskreads a text with the mask by position. Any other value is the raw value and fills the editable positions in order, with nothing removed from it.isMaskedText()holds the rule: a text has the mask when it has the length of the mask, each literal is in its place and no editable position holds half of an astral character. It followsisMaskedTextin theigc-mask-inputparser.getNonLiteralValuesis removed, as nothing uses it.IgxMaskDirectiveis not changed.Motivation / Context
With the mask
+1 (000) 000-0000, the literals are+,1, the space,(,)and-. Each1was taken for a literal:5551234567showed+1 (555) 123-4567, but the value was555234567.+1 (555) 234-567_, because the focus applies the mask to the text of the input again.5551234567set from code was shown as+1 (555) 234-567_.includeLiterals, the value+1 (555) 123-4567set from code was shown as+1 (555) 234-567_.CCC-CCC, the texta-b-___gave the valueab.This is part of the
igxMask/igc-mask-inputparity work (#17811).Behavior to be aware of: a value set from code that has literals in it but not the whole mask is now read as the raw value. With the mask
00/00, the value12/3is shown as12/_3. Before, it was shown as12/3_. A value with the whole mask, such as12/34, and a raw value, such as123, are read as expected. The rule can't be softer without bringing the bug back: if a character is skipped when it matches the literal the mask has reached, the raw value1234567890loses its first digit in the mask+1 (000) 000-0000. The changelog entry is marked as a behavioral change.This is the port of #18095 to
22.3.x, with the fix for its review finding included. The code differs frommasteronly wheremasterconverts the digits of other numbering systems, which this branch does not have.The changelog entry is under a new
22.3.3section, as22.3.2is released. The entries of #18085, which went in under22.3.2, are moved there too.Type of Change (check all that apply):
Component(s) / Area(s) Affected:
Mask
How Has This Been Tested?
Unit tests:
mask-parsing.service.spec.ts: the parsed value keeps a character that equals a literal, the mask applied to a raw value keeps it, a text with the mask keeps its positions, and a value without the whole mask is read as a raw value.mask.directive.spec.ts: the scenario of the issue, typing and then the next focus.applyMask: a raw value with the length of the mask.test-setup.tsofmaster, not committed here, because the localnode_moduleshas Angular 22.3.0, whose builder rejects the top-level await in thetest-setup.tsof this branch.Manual testing, on this branch, in the dev demos with temporary fields (not part of this pull request):
+1 (000) 000-0000: typing5551234567shows+1 (555) 123-4567and the model value is5551234567. The text stays the same after a blur and a focus.5551234567set from code: the input shows+1 (555) 123-4567.includeLiteralsand the value+1 (555) 123-4567set from code: the input shows+1 (555) 123-4567.CCC-CCC: typinga-bshowsa-b-___and the model value isa-b.Test Configuration:
Checklist:
feature/README.MDupdates for the feature docsCHANGELOG.MDupdates for newly added functionality🤖 Generated with Claude Code