Skip to content

Use LiveView focus stack and mount binding for modals - #38

Merged
ukutaht merged 1 commit into
mainfrom
codex/modal-liveview-focus
Oct 6, 2026
Merged

ukutaht merged 1 commit into
mainfrom
codex/modal-liveview-focus

Conversation

@ukutaht

@ukutaht ukutaht commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Modals with show={true} currently replay their opening logic on updates and reconnects, which can reopen a dismissed modal and overwrite the saved focus target and body scroll styles.

Use phx-mounted for initial visibility and LiveView's JS.push_focus / JS.pop_focus for focus restoration. Ignore repeated opens and share guarded cleanup between the end of the hide transition and removal of an open modal. Body scrolling stays locked until the close transition finishes.

Consolidate overlapping modal tests while covering initial visibility, rerenders, reconnects, repeated opens, backend open/close, and removal cleanup.

@ukutaht
ukutaht merged commit efc872d into main Oct 6, 2026
1 check passed
@ukutaht
ukutaht deleted the codex/modal-liveview-focus branch October 6, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant