5
11
Fork
You've already forked tomato
1

Fix dialog/hotwire interactions #135

Merged
edwardloveall merged 1 commit from el-dialog-turbo-fix into main 2026年04月13日 15:28:21 +02:00

When a <dialog> element is opened modally with .showModal(), the browser
moves it into the top layer.
Hotwire does page caching and restoration, but does not seem to know or
appropriately restore the top layer.

This causes dialogs to appear underneath content when navigating around the
site.

You can see it in previous versions of the code by:

  • open the shift or shift occurrence filter
  • submit the filter form
  • hit back
  • see filter superimposed

This fixes the problem by always closing any dialogs before turbo caches the
page.

https://github.com/hotwired/turbo/issues/1239

When a `<dialog>` element is opened modally with `.showModal()`, the browser moves it into the [top layer](https://developer.mozilla.org/en-US/docs/Glossary/Top_layer). Hotwire does page caching and restoration, but does not seem to know or appropriately restore the top layer. This causes `dialog`s to appear underneath content when navigating around the site. You can see it in previous versions of the code by: - open the shift or shift occurrence filter - submit the filter form - hit back - see filter superimposed This fixes the problem by always closing any dialogs before turbo caches the page. https://github.com/hotwired/turbo/issues/1239
edwardloveall changed target branch from el-anon-dump to main 2026年04月02日 16:40:12 +02:00
jsilasbailey left a comment
Copy link

TIL about the top layer, does the app use popovers that also need to be cleared or just dialogs?

TIL about the top layer, does the app use popovers that also need to be cleared or just dialogs?
edwardloveall force-pushed el-dialog-turbo-fix from c77598f7a7
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
to fed33ef94d
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful
2026年04月13日 15:20:16 +02:00
Compare
Author
Owner
Copy link

does the app use popovers that also need to be cleared or just dialogs

Just dialogs, but good call on popovers. I added some code to dismiss them as well.

> does the app use popovers that also need to be cleared or just dialogs Just dialogs, but good call on popovers. I added some code to dismiss them as well.
edwardloveall deleted branch el-dialog-turbo-fix 2026年04月13日 15:28:22 +02:00
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rootable/tomato!135
Reference in a new issue
rootable/tomato
No description provided.
Delete branch "el-dialog-turbo-fix"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?