Comments (3)
Thanks for your feedback and your kind words 😊
I haven't had much time to look at your code, but I had a glance. If I understand you correctly, you want to add APIs to control the lifecycle of the menu instead of relying on events doing it for you, in other words, control the opening/closing programmatically, right?
I think there's no reason not to have this, in fact, I had some similar requests in the past, because of the open
closeMenu
function, which is private at the moment.
Feel free to prepare a PR, I'll be happy to review it.
Please consider the following things:
- naming should be consistent: either
show
andhide
, oropen
andclose
. I wouldn't want to mix it. I prefer show and hide and maybe we should rename/delete the privateopen
closeMenu
function to avoid future confusion - The github pages file (./docs/demo.js) doubles as a manual test file, as there are no automated tests (yet). Feel free to add some buttons to the page to showcase the feature, or some hidden global functions.
- I've seen you've added tsdoc comments to the interface. If you could also add the documentation to the
README.md
that would be absolutely fantastic 💯
Thank you!
from ctxmenu.
The private open
closeMenu
method might not be required at all after your change, so if you can replace it with the new show
hide
method, feel free to delete it...
In your current implementation there are similar functions both for show and hide, which calls for confusion... 🙂
from ctxmenu.
Great! I will give it go in the next couple of days.
from ctxmenu.
Related Issues (20)
- Last menu item appears off screen HOT 1
- Delete menu item HOT 1
- Do not close menu on scroll HOT 1
- github pages always include latest changes
- Position Calculation is wrong when body has css transform HOT 6
- Make context menu accessible HOT 1
- Size calculation wrong when body has a scrollbar and menu would overflow HOT 1
- Allow Esc key press to close the context menu HOT 2
- Make menu appear next to cursor HOT 1
- Suggestion: Change divider color HOT 5
- Error on postinstall script in published version HOT 2
- Position Calculation is wrong when body has css transform bug (2) HOT 19
- Menu is opened at the wrong position when Enter key is pressed HOT 3
- Keyboard navigation HOT 3
- Access parent menu selected target HOT 10
- Support Callback Functions for Submenus
- onMouseEnter/-Leave Events HOT 4
- without tabindex, focus and blur events won't work
- Allow to register an event when the contextual menu is hidden HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ctxmenu.