Skip to content

PT-2989: Context menu closes when the window loses focus, for release-prep (#45) - #48

Merged
lyonsil merged 1 commit into
release-prepfrom
release-prep-45
Nov 4, 2026
Merged

lyonsil merged 1 commit into
release-prepfrom
release-prep-45

Conversation

@rolfheij-sil

@rolfheij-sil rolfheij-sil commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Brings #45 (PT-2989) onto release-prep. The editor's right-click context menu now closes as soon as the window loses focus, for example when the user clicks into another pane or another application. Before this, it stayed open over a window the user had already left. The source change is one useEffect in ContextMenuPlugin.tsx plus its tests, identical to main.

This pick is not an exact copy of main's commit, in its committed build output only. Please read this before merging and before the next rebase of release-prep onto main.

  • The source and test changes in libs/shared-react are identical to main. A patch-id taken over just those paths matches main's commit.
  • The committed bundle packages/platform/dist/index.js and its source map are built differently on release-prep. Main's bundle also contains PT-4974: Export the font part of the project stylesheet as generateUsjFontCss #42 (generateUsjFontCss), which is not on release-prep, so the plain cherry-pick conflicted in the source map. I did not merge it by hand. I reset the bundle to release-prep's and rebuilt it with pnpm rebuild-committed-output. The rebuild changed only those two files, by the same 8 added and 1 removed lines as main's commit. CI's committed-output check will confirm that the bundle matches the source.
  • Because the bundle part differs, the whole commit's patch-id differs from main's. At the next rebase of release-prep onto main, Git will not skip this commit automatically and may conflict in packages/platform/dist/index.js or index.js.map. If so, take main's version of packages/platform/dist. The same applies to PT-4960: Let an empty paragraph after a chapter be deleted, for release-prep (#39) #47's earlier pick of PT-4960: Let an empty paragraph after a chapter be deleted #39, whose bundle was rebuilt for the same reason.
  • It is a single commit, so any merge method keeps it as one commit.
  • Companion: paranext-core's pick of #2963, which makes menus and pickers close on window blur across panes. This fix relies on its focus-return behaviour, so the two belong together. Each is safe to merge alone. The app picks this up the next time core stages the editor from release-prep.

Testing on this branch, with dependencies installed from release-prep's lockfile: ContextMenuPlugin.test.tsx passes (29 tests). CI reruns here, including the committed-output check. No new live run. The source is identical to main, where #45 was live-checked together with core #2963.

AI-assisted — session

🤖 Generated with Claude Code


This change is Reviewable

The editor's context menu now closes when the window loses focus, the
way a native menu does. In Platform.Bible every pane is its own iframe,
so a click in a neighbouring pane or another application never produced
a pointerdown in the editor's document and left the menu open over a
window the user had already left.

ContextMenuPlugin gains a window `blur` listener, registered only while
the menu is open, that closes it. Element blurs inside the document do
not bubble to the window, so moving focus within the menu keeps it
open. Tests cover closing on window blur and staying open on an
element's own blur. packages/platform/dist is rebuilt; no public API
change.

The blur fires only if the editor's frame had focus when the menu
opened, so this relies on paranext-core#2963, under which core's
overlay service no longer pulls focus back to another pane after a
click elsewhere. Reaches Platform.Bible with the next editor package
update.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Session-URL: https://claude.ai/code/session_012P3p4bJXV7dm3VADUZtyNb
(cherry picked from commit 06cbc96)

On release-prep packages/platform/dist was rebuilt (pnpm rebuild-committed-output)
instead of merged, because release-prep's bundle differs from main's (main also has #42).
@lyonsil
lyonsil merged commit 69cd15d into release-prep Nov 4, 2026
2 of 3 checks passed
@lyonsil
lyonsil deleted the release-prep-45 branch November 4, 2026 14:08
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.

2 participants