Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293129

On views with AJAX enabled, exposed filter "reset" causes page load

$
0
0

Problem/Motivation

On a view with exposed filters, reset button, and AJAX enabled, the exposed filters work properly with AJAX (as do exposed sorts, including table heading click-sorting), but when you click the Reset button, there's a page load.

That ^^ on its own feels buggy, but the more problematic effect is: If you're using a view block/embed display, and that view also has a page display (even if you have link_display set to "None"), it doesn't just load the page you're on, it takes you to the view page display URL.

Workaround for "the more problematic effect": Separate the views (moving the page display to its own view or vice versa) -- there's still a page load when you hit "reset" on a block view display, but it keeps you on your current URL.

Note: This issue is "sort of a follow-up" to #2820347: Exposed filter reset redirects user to 404 page on AJAX view when placed as a block

Steps to reproduce

Reproduced on 9.5.0 and 10.0.5-dev.

Steps to reproduce the basic issue
  1. Create a view with: a page display, exposed filters, a reset button, and AJAX enabled.
  2. View your view page. At this point, you should see the view results, the exposed filters, and no reset button.
  3. Submit filters. The view results will be filtered without a page load (because AJAX), and now you'll see the reset button.
    • Also works with exposed sorts, and table heading click-sorting.
  4. Click Reset.

Result:There's a page load (and the results are reset).

Steps to reproduce "the more problematic effect"
  1. Create a view with: a page display, a block display, exposed filters, a reset button, and AJAX enabled (I've reproduced it with AJAX enabled on the entire view, and with AJAX only enabled on the block display).
    • I just added a block display to /admin/content, and placed it on a basic page.
  2. Find a place to place your block display (create a node or whatever).
  3. Block layout > Place the view block display somewhere (i.e. on the page you created in step 2).
  4. Go to wherever you placed the view block display (i.e. the page you created in step 2). At this point, you should see the view results, the exposed filters, and no reset button.
  5. Submit filters. The view results will be filtered without a page load (because AJAX), and now you'll see the reset button.
  6. Click Reset.

Result: You're taken to the view page display URL.

Furthermore: If you remove the page display from the view, and redo steps 4-5-6, you'll find that the page reloads in place.

Critical result:
As reported in #8 the issue breaks Core Media Library field widgets modals:
When adding filters to the Media Library view for selecting a media entity in the reference field, the page reloads when clicking "Reset" in the view in the media selection modal.
As a result, all the values entered in the form behind the modal are lost!
See the details here: #3376978: Media library widget reset button redirects user to access denied page.

Proposed resolution

The reset button should not cause a page load. Or, if a page load is a necessity, the page should reload in place, you shouldn't be taken from a view's block display to the view's page display.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 293129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>