- Issue created by @sophron
- 🇦🇺Australia sophron
Version Information
Drupal Core 10.4.0
Webform: 6.2.9
Theme: Olivero; Bootstrap5 - 🇺🇸United States jrockowitz Brooklyn, NY
This is a regression triggered via Drupal core.
Notice that although the title option is set to "Invisible", same does not apply to the "Date part" options selected
@see 🐛 Date list labels are not visible above select field creating bad UX Fixed
Drupal Core 10.3, Webform 6.2.9, Theme Claro 10.4
Date List - repeats title/label for each Date Part.
Appears to have changed after installing Gavias Edmix 3.0.1 even though Claro theme is selected
Can they be removed?
- 🇺🇸United States jrockowitz Brooklyn, NY
The select labels could be removed with a custom hook. Someone would have to write and share the code snippet.
- 🇺🇸United States jrockowitz Brooklyn, NY
jrockowitz → changed the visibility of the branch 3495192-date-list-part-title-display to hidden.
- Merge request !581Resolve #3495192 "Date list part title display v02" → (Open) created by jrockowitz
- 🇺🇸United States jrockowitz Brooklyn, NY
I created a POC MR to allows the date part title display to be customized.
- 🇮🇳India sdhruvi5142
Hi,
I've applied the MR!581 successfully for drupal core 10.3 and it is working as expected.Steps I followed for testing:
- Add "Date list" element to a webform
- Select all Date part options, or your preferred options
- Set "Title display to "Invisible"
- Save and View
- After applying I can see the new field named "Date part title display" set it to invisible and it is working as expected
Attaching Screenshots for reference
Status - PASS - Status changed to RTBC
3 months ago 10:05pm 24 February 2025 - 🇺🇸United States jrockowitz Brooklyn, NY
Here is quick fix for people wanting to revert back to the having the datelist title invisible.
/** * Implements hook_webform_element_alter()) */ function MYMODULE_webform_element_alter(array &$element, \Drupal\Core\Form\FormStateInterface $form_state, array $context) { if (isset($element['#type']) && $element['#type'] === 'datelist') { $element['#after_build'][] = 'MYMODULE_webform_element_datelist_after_build'; } } function MYMODULE_webform_element_datelist_after_build(array $element, FormStateInterface $form_state) { foreach (Element::children($element) as $child_key) { if (!isset($element[$child_key]['#title_display'])) { $element[$child_key]['#title_display'] = 'invisible'; } } return $element; }
- 🇺🇸United States bkosborne New Jersey, USA
This bit us too. I think a better approach for this element would be to render it as a fieldset, where the element name is the fieldset name, and then the individual date parts have visual labels for just the part above. That way the date part labels would not be so long and redundant: