Facets compatibility with views_ajax_history

Created on 13 January 2020, over 4 years ago
Updated 19 October 2023, 12 months ago

Problem/Motivation

At the moment, Facets doesn't have a way of managing browser state history. The desired user experience is... as a user interacts with facets they should be able to store that new filtered state in browser history. When a user navigates back and forth via browser navigation the expected state of the view should be updated asynchronously.

Proposed resolution

My proposal is to remove existing state management in facets-views-ajax.js and encourage the use of views_ajax_history to manage all expected ajax history state behaviors from facets, exposed filters, and pagination. In order to get facets to be processed by views_ajax_history the ajax_views_settings will need to include `ajax_view_settings.element`. Since facets uses anchor elements for all widgets the ajax request will be processed in views_ajax_history similarly to pagination. Updates will include an update to 'facets_filter' event to pass along entire jQuery element (not just href). In addition, ajax_view_settings needs to include ajax_view_settings.element that is set to the facet_item element (not jquery element). Once this is done the views_ajax_history will create the browser state as well as the 'popstate' events on the window during beforeSerialization().

Remaining tasks

  • Proposed solution and patch
  • Feedback/consensus building
  • Approved patch
  • Release notes

User interface changes

  • Drops support for URL updating

API changes

None

Data model changes

None

Release notes snippet

TBD

Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
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.

Production build 0.71.5 2024