Problem/Motivation

The help text is output above a single boolean checkbox field, because the field label is output in the checkbox label itself, so things look weird in this case.

Steps to reproduce

  1. Add a Boolean field type that uses the Single on/off checkbox
  2. Add Label help message to the field
  3. Observe the help is output above the checkbox

Proposed resolution

For a single checkbox, help text should be output with the description.

Issue fork label_help-3577350

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dave reid created an issue. See original summary.

dave reid’s picture

Status: Active » Needs review
anjuelsaphilip2020’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new24.77 KB
new33.79 KB

Hi, I've verified and tested MR !22 and applied the patch successfully on the Label Help 2.0.x-dev version. The changes are working as expected.
Following steps I followed:

  1. Go to Structure → Content types → Article → Manage fields.
  2. Add a new field:Field type: Boolean, Widget: Single on/off checkbox
  3. While creating the field, add a Label help message in the field settings.
  4. Save the field configuration.
  5. Go to Content → Add content → Article.
  6. Observe the placement of the help text for the checkbox field.

Testing Result: After applying the patch, the help text for the single checkbox field is displayed below the checkbox as part of the description, instead of appearing above the checkbox.
Attaching screenshots for reference.
Thanks

jwilson3’s picture

Thanks Dave, I remember looking at this when making the port to d8 many years ago and it seems the decision was to place the help text above the single checkbox, because the normal (Drupal default) description field already places it below.

@anjuelsaphilip2020 thank you for the screenshots. Would you mind taking a screenshot of where Drupal's in-built description field places text?, and then also having screenshots or copy/paste of the rendered DOM would be helpful for all three cases too.

Edit: To clarify, I'm not totally opposed to moving the text below (as depicted in the "after" screenshot), but we do need to be conscious that existing installs that are using the label help field explicitly in this case to place the text above, will show as a regression.

jwilson3’s picture

Status: Reviewed & tested by the community » Needs review
anjuelsaphilip2020’s picture

StatusFileSize
new38.23 KB

Hi, I've added additional screenshots for comparison: Drupal core Description field placement for a single checkbox.

jwilson3’s picture

Status: Needs review » Closed (works as designed)

Thank you so much @anjuelsaphilip2020!

So core-description-checkbox.png placement is exactly the same as the Label Help after-patch.png.

I hate to do this, Dave, but am inclined to close this as works as designed because the Label Help placement position for single checkboxes is currently in a novel location that cannot be achieved by core but after applying the change in the MR there is no longer any way to put help text above the checkbox, and the Label Help placement ends up being the same as what core description field already provides.

Long story short, if you want help text under the single checkbox, just move it from the Label Help field to the core Description field on the field config.

Happy to reconsider if there is another winning argument that I've somehow missed here though.

All the same, I've credited everyone on the contribution record. Thanks for your help and careful attention to make the module better.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.