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 21.2.29, as 21.2.28 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>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The positional mask-literal fix has no active review issues.
No open issues 🎉
What changed in this PR
Ports the positional mask-literal fix to 21.2.x, preserving user-entered characters that match literals and advancing parity with igc-mask-input.
Changes:
- Distinguishes fully masked text from raw values using character positions.
- Adds regression coverage for literal-valued input, refocusing, and astral characters.
- Documents the behavior change and organizes release notes under
21.2.29.
| 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 value preservation during typing and refocusing. |
| projects/igniteui-angular/directives/src/directives/mask/mask-parsing.service.ts | Implements positional literal detection and removes obsolete filtering. |
| projects/igniteui-angular/directives/src/directives/mask/mask-parsing.service.spec.ts | Covers raw and masked values, literal collisions, and astral input. |
| CHANGELOG.md | Adds 21.2.29 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
21.2.x, with the fix for its review finding included. The library code is the same as in the22.3.xport (#18100). It differs frommasteronly wheremasterconverts the digits of other numbering systems, which this branch does not have. The new test inmask.directive.spec.tsis in the Jasmine form of this branch, withfakeAsyncandtick.The changelog entry is under a new
21.2.29section, as21.2.28is released. The entries of #18086, which went in under21.2.28, 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.date-time.util.spec.ts, withNG0701: Missing locale data for the locale "ja-JP". It fails the same way without this change, because it needs locale data that another spec registers in a full run.Manual testing, on the
22.3.xport and onmaster, 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