It should be possible to set a field to required which is under a "details" element and have the javascript validation work correctly when the details element is not open.
For example, we want a menu link to be required when creating a node, so we set:
$form['menu']['enabled']['#required'] = TRUE;
$form['menu']['link']['title']['#required'] = TRUE;
In a hook_form_node_form_alter
This means that when submitting the form without checking the "Provide a menu link" checkbox, the user should be shown a validation error popup box. This works fine when the Menu Settings dropdown is expanded, but when it's closed a javascript error is produced:
"An invalid form control with name='menu[enabled]' is not focusable."
"An invalid form control with name='menu[title]' is not focusable."
Possibly - Check if the required field is hidden under a details element, and open the element before focussing the field?
Apologies if this is filed in the wrong place, I did some searching and couldn't find where the validation kicks in.
Closed: duplicate
11.0 🔥
forms system
The change/bugfix cannot be fully demonstrated by automated testing, and thus requires manual testing in a variety of environments.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.