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 drop two doubled blank lines left by the prompt character fix. Closes #17816 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The mask-length-matching branch splits astral characters into invalid positions, shifting subsequent valid characters and requiring code-point-safe iteration with a regression test.
1 open issue
What changed in this PR
Fixes mask literals being confused with editable characters, addressing #17816 and advancing parity with igc-mask-input.
Changes:
- Identifies literals by position when applying masks and extracting values.
- Adds regression tests for literal-valued input and refocusing.
- Documents the changed handling of partially formatted programmatic values.
| File | Description |
|---|---|
projects/igniteui-angular/directives/src/directives/mask/README.md |
Explains positional literals and formatted-value detection. |
projects/igniteui-angular/directives/src/directives/mask/mask.directive.ts |
Removes an extra blank line only. |
projects/igniteui-angular/directives/src/directives/mask/mask.directive.spec.ts |
Tests typing and refocusing with a numeric literal. |
projects/igniteui-angular/directives/src/directives/mask/mask-parsing.service.ts |
Replaces value-based literal filtering with positional handling. |
projects/igniteui-angular/directives/src/directives/mask/mask-parsing.service.spec.ts |
Tests literal preservation and raw-versus-formatted interpretation. |
CHANGELOG.md |
Records the fix and behavioral change. |
Review effort: Balanced
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>
This was referenced Dec 4, 2026
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. A text has the mask when it has the length of the mask and each literal is in its place. Any other value is the raw value and fills the editable positions in order, with nothing removed from it.isMaskedText()holds that rule. It is the same rule asisMaskedTextin theigc-mask-inputparser. A literal is also recognized when it is written as a digit of another numbering system, as before.getNonLiteralValuesis removed, as nothing uses it.IgxMaskDirectiveis not changed, except for a doubled blank line inwriteValue.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.The changelog entry is under
22.3.3, next to the entries of #18084, as the fix is also meant for22.3.xand21.2.x. The ports follow after the review of this pull request.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.Manual testing, 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. Undo and redo restore the text and the value.Test Configuration:
Checklist:
feature/README.MDupdates for the feature docsCHANGELOG.MDupdates for newly added functionality🤖 Generated with Claude Code