nkappler / ctxmenu

Tiny and customizable context menu generator
https://nkappler.de/ctxmenu/
MIT License
42 stars 5 forks source link

get the element which is right clicked #56

Open MaxBittker opened 3 months ago

MaxBittker commented 3 months ago

I am attaching a menu to all the images on my page using an img selector, and I want to access the specific item in the action handler or in onBeforeShow. is there any built in facility for handling this in the library? apologies if I've missed it

MaxBittker commented 3 months ago

it's the second argument to onBeforeShow

nkappler commented 3 months ago

Actually, thanks for opening this! It's a good reminder to improve the documentation.

The latest update was a quick addition of more lifecycle events, which were originally planned for the next major release and I hastily put up some documentation.

I'll reopen this issue, so I won't forget it. 😊

MaxBittker commented 3 months ago

the library is great, I've used many variations on this theme (radix, etc) and will use this one again in the future

MaxBittker commented 3 months ago

do you have any advice on ios safari long press? it doesn't seem to work on my ios device

nkappler commented 3 months ago

I've noticed this, too.

I think apple intentionally dropped support for the contextmenu event for usability reasons.

I'm not sure why, since it is still a common thing, at least outside of the web.

I probably will have to write some sort of polyfill for this, but I haven't looked into it in detail, so unfortunately I don't have a solution for it yet.