Enforce unique id if multiple views exposed forms are on the same page.

Created on 6 January 2022, over 3 years ago
Updated 26 July 2024, 12 months ago

Problem/Motivation

If the same views exposed form is placed on a page, the forms will both have the same id.

Steps to reproduce

Create a view with exposed filters and set "exposed form in block" to yes
Place the exposed filter block twice on a page of the site.
Inspect the form html or run a page check such as AXE. In my case both forms have the id "views-exposed-form-search-search-results"
<form action="/search" method="get" id="views-exposed-form-search-search-results" accept-charset="UTF-8" class="inline-form" data-drupal-form-fields="edit-search">

Proposed resolution

Add Html::getUniqueId() where we set the id

πŸ› Bug report
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated 1 day ago

Created by

πŸ‡¬πŸ‡§United Kingdom GHaddon

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¦πŸ‡ΊAustralia pameeela

    This is definitely covered by the many other related issues; so I'm closing this to avoid duplicated work.

  • πŸ‡―πŸ‡΄Jordan rahaf albawab Amman

    Reroll for the patch 9.5.x

  • πŸ‡ΊπŸ‡ΈUnited States andyg5000 North Carolina, USA

    Warning: The patch in #11 can cause issues with media_library widget. It causes the ajax/form-submit logic to break when clicking "apply filters" in the media library widget on a node form.

    The error is:
    Path: /admin/content/media-widget/image?name=sdf&sort_by=created. Drupal\Core\Http\Exception\CacheableAccessDeniedHttpException: The opener ID parameter is required and must be a string. in Drupal\Core\Routing\AccessAwareRouter->checkAccess() (line 115 of /var/www/html/docroot/core/lib/Drupal/Core/Routing/AccessAwareRouter.php).

Production build 0.71.5 2024