-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Milestone
Description
Describe the bug
In the JavaScript for the modal component, CSS classname strings are referenced via const variables in most but not all places where they are used. I need the code to use the const variables in all places because I'm trying to build the modal package with my own prefix (for example, fba-usa-
instead of usa-
) which only works if all classnames are constructed from the PREFIX
constant.
Steps to reproduce the bug
N/A exactly but here is a "bad code" example from packages/usa-modal/src/index.js.
const { prefix: PREFIX } = require("../../uswds-core/src/js/config");
const MODAL_CLASSNAME = `${PREFIX}-modal`;
...
const openFocusEl = targetModal.querySelector(INITIAL_FOCUS)
? targetModal.querySelector(INITIAL_FOCUS)
: targetModal.querySelector(".usa-modal");
Expected Behavior
And here is a good code example.
const { prefix: PREFIX } = require("../../uswds-core/src/js/config");
const MODAL_CLASSNAME = `${PREFIX}-modal`;
...
if (clickedElement.closest(`.${MODAL_CLASSNAME}`)) {...}
Related code
No response
Screenshots
No response
System setup
No response
Additional context
No response
Code of Conduct
- I agree to follow this project's Code of Conduct.
- I checked the current issues for duplicate bug reports.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done