Fixed
Project:
Drupal core
Version:
11.4.x-dev
Component:
forms system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Jun 2026 at 12:29 UTC
Updated:
30 Jul 2026 at 17:43 UTC
Jump to comment: Most recent
#3333481: Collapsed Details Element causes JS Error for required fields is a partial fix. There are elements that are form inputs that are not the input tag and can be required, eg textarea and select.
Add a required text area to collapsed details element and get frustrated
Improve the JS to cover for this case.
None
N/a
None
None
N/a
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
alexpottThis is a major UX bug. It completely flummoxed a content editor on a site I maintain and for good reason they were pressing submit on a node save and nothing was happening.
Comment #4
alexpottComment #5
alexpottComment #6
amitgoyal commentedReviewed MR !16025. The fix in details.js changes the CSS selector from 'details input[required]' to 'details :is(input, textarea, select)[required]', correctly extending the invalid-event handler to cover textarea and select required fields in addition to input.
The test form class is appropriately renamed to FormTestDetailsContainsRequiredFieldsForm and extended with new collapsed details elements containing required textarea and select fields. The FunctionalJavascript test is updated to cover all three field types.
PHPStan baseline entries are cleaned up.
Ran FormGroupingElementsTest locally (5 tests, 40 assertions, all pass).
LGTM.
Comment #10
godotislateCommitted and pushed 0b9591f to main and d725d52 to 11.x. Thanks!
Discussed with @longwave, and this is fine for backport to 11.4x. But there's a merge conflict in phpstan baseline for 11.4.x, so setting to Patch to be ported.
Comment #13
smustgrave commentedpretty clean backport, little fuzziness
Comment #15
godotislateCommitted 04fa987 and pushed to 11.4.x. Thanks!