Html validation error due to non allowed attributes

Created on 5 June 2025, 28 days ago

Hi, and thanks for the work on this module!

I see on a new site using the new BEF and exposing the new facets (from facets module, 3 branch) I get these errors in the validator. It might also belong to Facets module.

  • Attribute multiple not allowed on element div
  • Attribute name not allowed on element div

The code is this <div class="bef-links-use-ajax bef-links" data-drupal-selector="edit-type" multiple="multiple" name="type" id="edit-type--3">

..and, as it says, name and multiple is not allowed on div elements.

Report can be seen here: https://validator.w3.org/nu/?doc=https%3A%2F%2Faqua-kompetanse.no

πŸ› Bug report
Status

Active

Version

7.0

Component

Miscellaneous

Created by

πŸ‡³πŸ‡΄Norway vegardjo

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

Merge Requests

Comments & Activities

  • Issue created by @vegardjo
  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    This is happening because it is a component of type select, but it is themed using a div element in bef-links.html.twig.

    Why does it use a select component? That appears to be set in class DefaultWidget.

  • First commit to issue fork.
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Simple enough to remove.

  • πŸ‡³πŸ‡΄Norway vegardjo

    Thanks, I will try the patch shortly!

    However, found another related bug. Not sure it's better tackled here or in a new issue, but the full markup is:

          <label for="edit-type--3">Content type</label>
            <div class="bef-links-use-ajax bef-links" data-drupal-selector="edit-type" multiple="multiple" name="type" id="edit-type--3">
    [...]
    

    ..we can't use a label for a div, but we could if it was a select, so I guess it has the same root cause.

  • πŸ‡³πŸ‡΄Norway vegardjo

    I can confirm that the PR as of now removes the validation errors of multiple and name, and also that the error described in my comment #6 remains.

  • πŸ‡¨πŸ‡¦Canada Liam Morland Ontario, CA πŸ‡¨πŸ‡¦

    The label element issue is addressed in πŸ› Accessibility: Orphaned form label Active .

  • πŸ‡³πŸ‡΄Norway vegardjo

    I don't believe that is exactly the same issue, the validation error is not the same, and also the fix would not fix this. The label element in that issue is in front of an <input> element, which is allowed, but the label in my case prefixes a <div>, which since it is not a form element, should not have a <label> at all.

    The reason is likely that when using a select element it is likely also using the form-element-label.html.twig.

    Not really sure what it could use instead, though..

Production build 0.71.5 2024