form-element component drops webform classes

Created on 26 January 2024, 12 months ago
Updated 30 July 2024, 6 months ago

Problem/Motivation

I wondered why the classes I've set on the field level in a webform does not take effect.

Steps to reproduce

Set, for example, a "hidden" class on a webform field "Wrapper-Attribute".

Proposed resolution

Turn this:
{% set form_element_attributes = form_element_attributes ?: create_attribute() %}

into this:
{% set form_element_attributes = attributes ?: create_attribute() %}

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

6.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @thomas.frobieter
  • Status changed to Closed: works as designed 12 months ago
  • Thanks for the issue Thomas, This probably broke with an update of Radix parent theme, but we are trying to move away from simply naming things attributes for overriding issues and readability matters, so {% set form_element_attributes = form_element_attributes ?: create_attribute() %} is correct and you probably need to update things on your sub-theme level

    closing as works as designed

  • Thx for the clarification @doxigo!

    I am on 6.x-dev (just pulled the recent changes), and it's still broken without this modification in the form/form-element.html.twig:

    {% include "radix:form-element" with {
      form_element_attributes: attributes
    } %}
    

    HTML Output:

    With the modification:

    <div class="hidden webform-element-help-container--title webform-element-help-container--title-after js-form-item form-item form-type-url js-form-type-url form-item-cta-page-url js-form-item-cta-page-url form-disabled disabled form-group" data-component-id="radix:form-element">
    

    Without the modification:

    <div class="js-form-item form-item form-type-url js-form-type-url form-item-cta-page-url js-form-item-cta-page-url form-disabled disabled form-group">
    

    Webform configuration (sorry for the German translation, but hopefully it will be clear):


  • πŸ‡«πŸ‡·France PhilY πŸ‡ͺπŸ‡ΊπŸ‡«πŸ‡· Paris, France

    Sorry to reopen the issue, but I'm facing the exact same behavior and same fix with a brand new subtheme generated using today's downloaded dev release of Radix (composer require 'drupal/radix:6.0.x-dev@dev'), either setting the subtheme or radix as the default theme: webform field wrapper class is gone...

  • Status changed to Active 10 months ago
  • πŸ‡«πŸ‡·France PhilY πŸ‡ͺπŸ‡ΊπŸ‡«πŸ‡· Paris, France
  • Hey Phil, thanks for re-opening, the issue was within the form-element, pushed a fix

  • Status changed to Fixed 10 months ago
    • 6b3b3d34 committed on 6.0.x
      Issue #3417130 by thomas.frobieter, PhilY, doxigo: form-element...
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica
Production build 0.71.5 2024