- Issue created by @luke.leber
- Open on Drupal.org βCore: 10.1.4 + Environment: PHP 8.2 & MySQL 8last update
9 months ago Waiting for branch to pass - Status changed to Needs review
9 months ago 7:50pm 29 March 2024 - πΊπΈUnited States luke.leber Pennsylvania
Seems HEAD was broken. Back to NR. π
- Status changed to Closed: works as designed
9 months ago 2:20pm 4 April 2024 - πΊπΈUnited States jrockowitz Brooklyn, NY
The delimiter can be displayed to elements left or right, which is why the #field_suffix is used.
- Status changed to Needs review
9 months ago 7:57pm 5 April 2024 - πΊπΈUnited States luke.leber Pennsylvania
Hey Jacob,
I may not have communicated things as clearly as intended, so I recorded a quick screencast that walks through what I found (~3 minutes). If I'm still not understanding correctly, please feel free to re-close and I won't re-open it again.
Thanks!
- πΊπΈUnited States luke.leber Pennsylvania
Problem/Motivation
Living example of how this issue impacts a "real" site: https://dev9.worldcampus.psu.edu/form/example-ranges
When configuring a Range element to Output the range's value to the Left AND there is not a prefix set on the range element itself, the output element is erroneously rendered as a field suffix!
This is the code in question:
https://git.drupalcode.org/project/webform/-/blob/6.2.x/src/Plugin/Webfo...
if ($element['#output'] === 'left') { if (isset($element['#field_prefix'])) { $element['#field_prefix'] = [ 'output' => $output, 'delimiter' => ['#markup' => '<span class="webform-range-output-delimiter"></span>'], 'content' => (is_array($element['#field_prefix'])) ? $element['#field_prefix'] : ['#markup' => $element['#field_prefix']], ]; } else { $element['#field_suffix'] = [ // <-- Shouldn't this be $element['#field_prefix'] instead? 'output' => $output, 'delimiter' => ['#markup' => '<span class="webform-range-output-delimiter"></span>'], ]; } }
Steps to reproduce
See attached webform; note that the Range (value to left) element renders incorrectly.
Proposed resolution
Super simple! Let's change '#field_suffix' to '#field_prefix'!
User interface changes
If anyone has worked around this by using something like `flex-direction: row-reverse`, their hack-around will break.
API changes
None
Data model changes
None
-
jrockowitz β
committed b82587f0 on 6.3.x authored by
luke.leber β
Issue #3431453: Probable typo in Range element for "left" configuration
-
jrockowitz β
committed b82587f0 on 6.3.x authored by
luke.leber β
- πΊπΈUnited States jrockowitz Brooklyn, NY
Yep, I see the typo now. Thanks!
-
jrockowitz β
committed b82587f0 on 6.x authored by
luke.leber β
Issue #3431453: Probable typo in Range element for "left" configuration
-
jrockowitz β
committed b82587f0 on 6.x authored by
luke.leber β
Automatically closed - issue fixed for 2 weeks with no activity.