-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
Describe the bug
The insert for the generated span to mask the input is currently targeted at the closest form input.closest(CONTEXT).insertBefore(shell, input);
which works for the example in the documentation because the input is a direct child of the form. However, when nested under any additional markup the insert fails (The node before which the new node is to be inserted is not a child of this node.
).
Steps to reproduce the bug
- Create a masked input where the input element is nested in any extra markup that prevents it from being a direct child of the form.
- Open the page the form is present on.
Expected Behavior
The input should be masked.
Related code
packages/usa-input-mask/src/index.js
line 38 is currently
input.closest(CONTEXT).insertBefore(shell, input);
but should be
input.parentNode.insertBefore(shell, input);
Screenshots
No response
System setup
- USWDS version: 3.6.0
Additional context
This issue is resolved in Version 2, however, it's unclear when that will be released so I've submitted a stand alone PR with only this fix - sorry if this is noise.
Code of Conduct
- I agree to follow this project's Code of Conduct.
- I checked the current issues for duplicate bug reports.
sawyerh
Metadata
Metadata
Labels
Type
Projects
Status
Done