Skip to content

Commit 77b9f54

Browse files
committed
Close drop down menus before caching the page
This avoids a flickering when closing modals coming back to the underlying page.
1 parent 61403f3 commit 77b9f54

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

admin/app/components/solidus_admin/orders/show/component.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<%= page do %>
1+
<%= page("data-action": "turbo:before-cache@window->#{stimulus_id}#closeMenus") do %>
22
<%= page_header do %>
33
<%= page_header_back(solidus_admin.orders_path) %>
44
<%= page_header_title(t('.title', number: @order.number)) %>
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { Controller } from '@hotwired/stimulus'
22

33
export default class extends Controller {
4-
4+
closeMenus() {
5+
this.event.querySelectorAll('details').forEach(details => details.removeAttribute('open'));
6+
}
57
}

0 commit comments

Comments
 (0)