Commit c2fc48d
authored
[Conditional Field] Include buttons in enable/disable sweep (#314)
## Changes
Adds `button` to the list of elements that the conditional field
component's Stimulus controller enables/disables when toggling
visibility.
Before:
```js
this.element.querySelectorAll("input, select, textarea")
```
After:
```js
this.element.querySelectorAll("input, select, textarea, button")
```
## Context
When a conditional field starts hidden, its input elements are disabled
so they don't get submitted with the form. If a USWDS date picker is
inside that wrapper, USWDS notices the disabled input when it attaches
and also disables the calendar button it adds. When the user later
clicks the radio to show the section, our re-enable pass only covered
inputs/selects/textareas, so the USWDS calendar button stayed disabled
and clicking it did nothing.
Adding `button` to the sweep lets `show()` re-enable the calendar button
(and any other button nested in the wrapper) alongside the form fields.
## Testing
Verified on the strata-paidleave PR environment at
`/lookbook/inspect/applicants/leave_applications/employment_details/default`:
clicked "Yes" under "Have you told this employer...", then clicked the
calendar icon — calendar dropdown opens correctly.
Companion PR (keeps the test deploy wired up):
navapbc/strata-paidleave#109
<img width="1304" height="1264" alt="Screenshot 2026-04-18 at 1 54
22 PM"
src="https://github.com/user-attachments/assets/34169df3-641d-4f53-935f-42be76ec0c52"
/>
https://github.com/user-attachments/assets/fa8cfc1a-e08c-4999-8a86-71e4e8c5f9fd1 parent 22b316b commit c2fc48d
1 file changed
Lines changed: 2 additions & 2 deletions
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
0 commit comments