fix open modal mobile

This commit is contained in:
Pete Matsyburka
2026-07-30 17:40:54 +03:00
parent 3667993caf
commit 50ec7682b5
20 changed files with 124 additions and 65 deletions
+15
View File
@@ -0,0 +1,15 @@
export default class extends HTMLElement {
connectedCallback () {
this.addEventListener('click', this.onClick)
}
disconnectedCallback () {
this.removeEventListener('click', this.onClick)
}
onClick = (e) => {
e.preventDefault()
window.history.back()
}
}
@@ -1,8 +1,9 @@
export default class extends HTMLElement {
connectedCallback () {
if (!this.isMobile()) return
if (window.innerWidth >= 768) return
document.querySelectorAll('a[data-turbo-frame="modal"]').forEach((link) => {
this.querySelectorAll('a[data-turbo-frame]').forEach((link) => {
link.dataset.turboFrame = '_top'
})
}
+1 -5
View File
@@ -42,10 +42,6 @@ export default actionable(class extends HTMLElement {
close = (e) => {
e?.preventDefault()
if (!this.closest('turbo-frame')?.src && window.history.length > 1) {
window.history.back()
} else {
this.remove()
}
this.remove()
}
})