Exposed Filter in Views Redirects to Page Display Path Instead of Block Path

Created on 19 July 2024, 3 months ago
Updated 7 August 2024, 2 months ago

Problem/Motivation

When creating a view in Drupal with an exposed filter, and then embedding this view as a block on a specific page, the user is redirected to the page display path of the view when applying the filter, instead of staying on the same page where the block is embedded.

Steps to reproduce

Install Drupal 10.3.1 with the standard profile.
Add a new "Test view" view with default settings (Show: Content of type: All, etc.).
Click "Save and edit".
Add a new filter for Content type and enable the "Expose this filter to visitors, to allow them to change it" option. Save the settings.
Add a new Block display to the view.
Add a new Page display to the view.
Set the path for the Page display to "test-view".
Save the view.
Create a new "Basic page" node with the title "Test page" and the URL alias "Test". Save the node.
Navigate to Structure > Block layout and click "Place block" in the Content region.
Find the "Test view" block and click "Place block".
In the Visibility section, go to the Pages tab and enter "/test". Save the block.
Open the "/test" URL and observe the page with the injected view block containing the exposed Content type filter.
Select any value from the Content type dropdown and press Apply.

Expected Behavior:
The user remains on the same page, and the view block updates to show the filtered results.

Actual Behavior:
The user is redirected to the "/test-view" URL, the path set for the view page display, causing confusion and navigation issues.

🐛 Bug report
Status

Closed: works as designed

Version

10.3

Component
Views 

Last updated about 2 hours ago

Created by

🇺🇸United States xopoc

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

Comments & Activities

  • Issue created by @xopoc
  • 🇮🇳India DimpleL

    Hi, As a workaround, you can use the setting available under Advanced called "Use AJAX." Setting "Use AJAX" to "yes" will resolve the issue for now.

  • Status changed to Closed: works as designed 2 months ago
  • 🇳🇱Netherlands Lendude Amsterdam

    This is by design, Views will look for the first display with a path and use that. You can try #2 or make the block and page be separate Views and not 2 displays on the same View.

Production build 0.71.5 2024