Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(web-twig): Pass missing id attributes to the form components #1465

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,13 @@
className="{{ _helperTextClassName }}"
elementType="span"
helperText="{{ _helperText }}"
id="{{ _id }}"
UNSAFE_helperText="{{ _unsafeHelperText }}"
/>
<ValidationText
className="{{ _validationTextClassName }}"
elementType="span"
id="{{ _id }}"
validationState="{{ _validationState }}"
validationText="{{ _validationText }}"
UNSAFE_validationText="{{ _unsafeValidationText }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
</div>
<HelperText
className="{{ _helperTextClassName }}"
id="{{ _helperTextId }}"
helperText="{{ _helperText }}"
id="{{ _helperTextId }}"
UNSAFE_helperText="{{ _unsafeHelperText }}"
/>
<ValidationText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@
<HelperText
className="{{ _helperTextClassName }}"
helperText="{{ _helperText }}"
id="{{ _id }}"
UNSAFE_helperText="{{ _unsafeHelperText }}"
/>
</div>
<ValidationText
className="{{ _validationTextClassName }}"
id="{{ _id }}"
validationState="{{ _validationState }}"
validationText="{{ _validationText }}"
UNSAFE_validationText="{{ _unsafeValidationText }}"
Expand Down
11 changes: 6 additions & 5 deletions packages/web-twig/src/Resources/components/Item/Item.twig
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
{%- set _classNames = [ _rootClassName, _disabledClassName, _selectedClassName, _styleProps.className ] -%}
{%- set _selectedIconName = 'check-plain' -%}

<{{ _elementType }}
{{ mainProps(props) }}
{{ styleProp(_styleProps) }}
{{ classProp(_classNames) }}
<{{ _elementType }}
{{ mainProps(props) }}
{{ styleProp(_styleProps) }}
{{ classProp(_classNames) }}
{{ _hrefAttr }}
{{ _targetAttr }}
{{ _typeAttr }}
Expand All @@ -57,9 +57,10 @@
{%- endif -%}
</span>
<HelperText
elementType="span"
className="{{ _helperTextClassName }}"
elementType="span"
helperText="{{ _helperText }}"
id="{{ 'item-helper-text' }}"
Copy link
Contributor Author

@dlouhak dlouhak Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary state. I know we shouldn't use same ID on the page more than once…

I'm not sure how to handle passing id if the component Item doesn't accept one. Use label in the kebab-case syntax, or extend API?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried to do this the same way as in all other components, but since the is is not mandatory it is hard to say. Maybe the easiest way to fix this is just to set id as required for the Item component.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the ValidationText and HelperText optional, so this is no longer needed. See #1470

UNSAFE_helperText="{{ _unsafeHelperText }}"
/>
{% if _isSelected %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
className="{{ _helperTextClassName }}"
elementType="span"
helperText="{{ _helperText }}"
id="{{ _id }}"
UNSAFE_helperText="{{ _unsafeHelperText }}"
/>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@
<HelperText
className="{{ _helperTextClassName }}"
helperText="{{ _helperText }}"
id="{{ _id }}"
UNSAFE_helperText="{{ _unsafeHelperText }}"
/>
<ValidationText
className="{{ _validationTextClassName }}"
id="{{ _id }}"
validationState="{{ _validationState }}"
validationText="{{ _validationText }}"
UNSAFE_validationText="{{ _unsafeValidationText }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@
<HelperText
className="{{ _helperTextClassName }}"
helperText="{{ _helperText }}"
id="{{ _id }}"
UNSAFE_helperText="{{ _unsafeHelperText }}"
/>
<ValidationText
className="{{ _validationTextClassName }}"
id="{{ _id }}"
validationState="{{ _validationState }}"
validationText="{{ _validationText }}"
UNSAFE_validationText="{{ _unsafeValidationText }}"
Expand Down
Loading