Repository navigation
Conversation
The dialog lingers for DIALOG_EXIT_MS (160 ms) with `pointer-events: none` on the leaving layer, so a click there reaches the page behind it. The unmount then put focus back on the opener unconditionally, taking it away from the element the user had just focused. Restore only while the dialog still holds focus (or nothing does). Fixes ThinkFlowLab#2270 Owner: Dev-4 Written-by: Dev-4 Reviewer: Birfy Base: 5008116
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2270
Written-by: Dev4
Owner: Dev4
Reviewer: Birfy
Claim-Id: a603143791a442c5a147c232dc187b76
Branch: dev/4-p472-settings-focus-restore
Base: 5008116
Tree: 1a6fa3be9ebeadc91c31141a463439fb5c81c5cc
Verified commit: 3762107
Pushed head: 3762107
Scope
#2262made the Settings dialog hand focus back to its opener inuseDialogFocus's unmount cleanup, unconditionally. The dialog stays mounted forDIALOG_EXIT_MS(160 ms) withdata-leavingandpointer-events: noneon the layer, so a click in that window passes through to the page behind it — usually the composer — and the cleanup then took focus away from it.The cleanup in
core/src/client/overlay-hooks.jsnow restores focus only while the dialog still holds it (document.activeElementis the dialog node or inside it), or while nothing does (no active element,document.body, or a node the browser has disconnected). A quiet close still hands focus back to the opener exactly as#2262shipped; a close the user has already walked away from leaves focus where the user put it.core/test/dialog-focus.test.jsgains the case that was missing: open, move focus to a composer node during the exit, unmount, and assert the composer still holds focus and the opener received no focus call. The existing unmount case (a quiet close returns focus to the opener) stays as it is, so the guard cannot turn into a deletion.docs/subsystems/core-client.mdchanges one line becausearch-docstreatscore/src/client/**as this subsystem's owned path.Files
core/src/client/overlay-hooks.js— the guard in the cleanup.core/test/dialog-focus.test.js— the new case, and the existing case kept.docs/subsystems/core-client.md— one line, the focus hand-back rule.changelog.d/2270-settings-focus-restore.fixed.md— the changelog fragment.core/client.js— generated bynpm run build.patches/ds-bot/0003-flybot-api-client.patch,patches/ds-bot/0008-client-bundle.patch,patches/ds-bot/files/test/dialog-focus.test.js— generated bynode scripts/ds-bot-patches.mjs generate.Readings attached at the final tip; this draft reserves the issue and requests no review.