-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Summary
Combobox markup is built with a select
element that is moved offscreen and replaced with an input
element during initialization. Classes set on the select element are not transferred to the new input element, making it difficult for users to use classes to style the input.
Steps to reproduce the bug
- Add combobox markup to a page.
- Add additional styles to the
select
element. - Open page in browser.
- Inspect combobox
input
. - Confirm classes are missing.
Expected behavior
Classes should be transferred to the input
element.
This behavior is similar to how usa-modal
transfers attributes to its placeholder or file input moves dropzone classes from the file input to the file input parent.
Modal
uswds/packages/usa-modal/src/index.js
Lines 200 to 205 in 114f6e5
modalAttributes.forEach((attribute) => { | |
originalLocationPlaceHolder.setAttribute( | |
`data-original-${attribute.name}`, | |
attribute.value | |
); | |
}); |
File input
uswds/packages/usa-file-input/src/index.js
Lines 150 to 153 in 114f6e5
// Adds class names and other attributes | |
fileInputEl.classList.remove(DROPZONE_CLASS); | |
fileInputEl.classList.add(INPUT_CLASS); | |
fileInputParent.classList.add(DROPZONE_CLASS); |
Additional context
This functionality is need to initialize combobox in it's error state, as discovered in #5879
Metadata
Metadata
Assignees
Labels
Type
Projects
Status