Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Split ContextMenu into ContextMenuInner subcomponent #622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
NyxCode wants to merge 9 commits into carbon-design-system:master
base: master
Choose a base branch
Loading
from NyxCode:split-context-menu

Conversation

@NyxCode
Copy link

@NyxCode NyxCode commented May 3, 2021

See #620
This PR extracts most functionality of ContextMenu to ContextMenuInner, except event handling.
The functionality of ContextMenu should be unaffected by this.

ContextMenuInner can now be used when listening for on:contextmenu on window is undesirable. In the documentation, I added an example for binding the context menu to only a single element.

I'm pretty new to svelte & this library, so please thoroughly review my changes.

image

geoidesic reacted with rocket emoji
Copy link

vercel bot commented May 3, 2021
edited
Loading

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/carbon-svelte/carbon-components-svelte/HGdrjrhuNVnNwX63mSVKUHTABUVS
✅ Preview: https://carbon-compone-git-fork-nyxcode-split-context-menu-carbo-852ad5.vercel.app

@NyxCode NyxCode changed the title (削除) Split context menu (削除ここまで) (追記) Split context menu into ContextMenuInner subcomponent (追記ここまで) May 3, 2021
@NyxCode NyxCode changed the title (削除) Split context menu into ContextMenuInner subcomponent (削除ここまで) (追記) Split ContextMenu into ContextMenuInner subcomponent (追記ここまで) May 3, 2021
Copy link

Any chance of resolving the conflicts?

Copy link

geoidesic commented Jun 27, 2021
edited
Loading

I tried just using the ContextMenuInner on it's own and I get this error, which I can't interpret:

proxy.js:15 [HMR][Svelte] Unrecoverable error in <ContextMenuOption>: next update will trigger a full reload
ContextMenuOption.svelte? [sm]:79 Uncaught (in promise) TypeError: Cannot read property 'subscribe' of undefined
 at instance (ContextMenuOption.svelte? [sm]:79)
 at init (index.mjs?v=cfb104fc:1660)
 at new ContextMenuOption (ContextMenuOption.svelte? [sm]:129)
 at createProxiedComponent (svelte-hooks.js:245)
 at new ProxyComponent (proxy.js:241)
 at new Proxy<ContextMenuOption> (proxy.js:341)
 at Array.create_default_slot (SceneThumb.svelte:1)
 at create_slot (index.mjs?v=cfb104fc:61)
 at create_fragment (ContextMenuInner.svelte? [sm]:37)
 at init (index.mjs?v=cfb104fc:1675)

Copy link

I would consider calling it ElementContextMenu. As when it is used in isolation without the Global it is not Inner.

I also notice that if it is used without the Global, right-click outside of the context menu does not close it. This is undesirable. I had a go at fixing it but couldn't figure out how @NyxCode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /