mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-25 05:02:57 +01:00
Reset filters' w-drilldown state on close
This fixes the issue where the state is stuck at the last opened filter when the drilldown's contents are replaced
This commit is contained in:
parent
238cbf3cd2
commit
bc381be264
@ -57,6 +57,16 @@ export class DrilldownController extends Controller<HTMLElement> {
|
||||
this.activeSubmenuValue = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Delay closing the submenu to allow the top-level menu to fade out first.
|
||||
* Useful for resetting the state when the user clicks outside the menu.
|
||||
* This can be used as an action for the w-dropdown:hidden event of the menu,
|
||||
* e.g. data-action="w-dropdown:hidden->w-drilldown#delayedClose".
|
||||
*/
|
||||
delayedClose() {
|
||||
setTimeout(() => this.close(), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Derive the component’s targets based on the state,
|
||||
* so the drilldown state can be controlled externally more easily.
|
||||
|
@ -79,7 +79,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% if filters %}
|
||||
<div id="filters-drilldown" class="w-drilldown" data-controller="w-drilldown" data-action="w-swap:success@document->w-drilldown#updateParamsCount">
|
||||
<div id="filters-drilldown" class="w-drilldown" data-controller="w-drilldown" data-action="w-swap:success@document->w-drilldown#updateParamsCount w-dropdown:hide->w-drilldown#delayedClose">
|
||||
{% include "wagtailadmin/shared/headers/_filters.html" with filters=filters only %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user