feat(scatter-plot): right-click context menu (Copy ID, View in UniProt)#233
Draft
jcoludar wants to merge 1 commit into
Draft
feat(scatter-plot): right-click context menu (Copy ID, View in UniProt)#233jcoludar wants to merge 1 commit into
jcoludar wants to merge 1 commit into
Conversation
Adds a `protspace-context-menu` Lit element wired into `protspace-scatterplot` via a `@contextmenu` listener on the plot container. Right-clicking a point opens a small menu with two actions: - Copy ID — writes the protein id to the clipboard - View in UniProt — opens the UniProt entry in a new tab (disabled when the id is not a UniProt accession) The menu also dispatches a `context-menu-action` CustomEvent on the host so consumers can extend with app-level actions later. Click-outside detection uses `composedPath()` to work correctly across nested shadow DOMs. Includes a unit test for `resolveMenuItems` covering hit/no-hit and disabled-on-no-accession paths.
4 tasks
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.
Summary
protspace-context-menuLit element registered inpackages/core/src/components/scatter-plot/.protspace-scatterplotvia a@contextmenulistener on the plot container; right-clicking a point opens a small menu.navigator.clipboard.writeText(proteinId)https://www.uniprot.org/uniprotkb/{id}/entryin a new tab; disabled when the id is not a UniProt accession.context-menu-actionCustomEvent on the host for consumers that want to extend with app-level actions later.event.composedPath()so it works correctly across nested shadow DOMs (the host scatter-plot lives inside its own shadow root).Why this PR
Spun out of #231. After taking #232 as the path forward for the publication-export work, the right-click context menu is the one piece from #231 that's orthogonal to the export modal and useful on its own. Everything else in #231 is being dropped.
Test plan
pnpm type-check(clean)pnpm test— added 3-test suite forresolveMenuItems(hit / no-hit / no-accession), 588 tests total passpnpm lint— no new warningspnpm buildandpnpm docs:build(pre-commit)