Skip to content

Commit

Permalink
Close drop down menus before caching the page
Browse files Browse the repository at this point in the history
This avoids a flickering when closing modals coming back to the
underlying page.
  • Loading branch information
elia committed Nov 6, 2023
1 parent 24cb2d1 commit 4a13a62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= page do %>
<%= page("data-action": "turbo:before-cache@window->#{stimulus_id}#closeMenus") do %>
<%= page_header do %>
<%= page_header_back(solidus_admin.orders_path) %>
<%= page_header_title(t('.title', number: @order.number)) %>
Expand Down
4 changes: 3 additions & 1 deletion admin/app/components/solidus_admin/orders/show/component.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Controller } from '@hotwired/stimulus'

export default class extends Controller {

closeMenus() {
this.event.querySelectorAll('details').forEach(details => details.removeAttribute('open'));
}
}

0 comments on commit 4a13a62

Please sign in to comment.