Skip to content

Commit

Permalink
πŸ› Submit the print options form on page load to sync browser state
Browse files Browse the repository at this point in the history
Why:
- When the browser navigates backward and then again forward, the
  browser remembers the state of all forms. But that does not trigger a
  change event on the form elements. This causes the form selection to
  be out of sync with what is shown on the page. It's not known if there
  is an event that could be listened. As a workaround we submit the
  form right after the form is loaded.
  • Loading branch information
luontola committed Jul 11, 2024
1 parent 0be5fb8 commit 0494f40
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/territory_bro/ui/printouts_page.clj
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

[:form#print-options.pure-form.pure-form-stacked {:method "post"
:hx-post html/*page-path*
:hx-trigger "change delay:250ms"
:hx-trigger "load delay:1ms, change delay:250ms"
:hx-sync "#print-options:replace"
;; morph the form to keep form element focus and scroll state
:hx-select "#print-options"
Expand Down

0 comments on commit 0494f40

Please sign in to comment.