Facets v3 not visible in Layout Builder with Views exposed filters until AJAX search

Created on 11 April 2025, 13 days ago

Problem/Motivation

When using Facets v3 with a Views block and its exposed filters exposed as separate blocks in Layout Builder, facets do not render on initial page load. To have exposed filters as a block in a view block display we need to install the module views_block_filter_block too. They only appear after performing an AJAX-enabled search. This creates a confusing user experience and breaks the expected integration between facets and exposed filters.
If the view is placed above the exposed filters block, then the facets are rendered properly.

I understand this issue is with facets, a contrib module, but I don't think would be solvable without changes in core.

Steps to reproduce

  1. Create a View with exposed filters and enable AJAX.
  2. Configure Facets v3 for the View.
  3. Place the Views block, exposed filters block, and facets block in Layout Builder.
  4. Load the page: facets are missing.
  5. Perform an AJAX search: facets now appear.

Proposed resolution

This is caused because the method \Drupal\views\Plugin\views\display\DisplayPluginBase::viewExposedFormBlocks() is calling to initHandlers() but not executing the view, so when the exposed filters block is rendered before the view, the facets won't be rendered

Remaining tasks

TBD

User interface changes

None expected. Facets will appear consistently without requiring an AJAX interaction.

Introduced terminology

None.

API changes

None anticipated.

Data model changes

None.

Release notes snippet

🐛 Bug report
Status

Active

Version

11.1 🔥

Component

views.module

Created by

🇪🇸Spain akalam

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

Comments & Activities

Production build 0.71.5 2024