Probable typo in Range element for "left" configuration

Created on 18 March 2024, 9 months ago

Problem/Motivation

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:

      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

πŸ› Bug report
Status

Active

Version

6.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States luke.leber Pennsylvania

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024