Skip to content

Commit 3a5daf8

Browse files
committed
Fix turbo cache event handling for details dropdown
Corrected the Stimulus controller event handling to ensure dropdown <details> close on modal open/close. Previously, the `turbo:before-cache` event was not properly connected to the Stimulus controller, causing menus to remain open after a modal was triggered. The 'closeMenus' method within the controller was attempting to call 'querySelectorAll' on 'this.event', which is undefined within the Stimulus context. This update corrects the 'closeMenus' method to reference 'this.element', ensuring that it correctly targets the controller's DOM element.
1 parent ae29975 commit 3a5daf8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

admin/app/components/solidus_admin/orders/show/component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import { Controller } from '@hotwired/stimulus'
22

33
export default class extends Controller {
44
closeMenus() {
5-
this.event.querySelectorAll('details').forEach(details => details.removeAttribute('open'));
5+
this.element.querySelectorAll('details').forEach(details => details.removeAttribute('open'));
66
}
77
}

0 commit comments

Comments
 (0)