Override component events
TLDR: I used
onContextMenu
in a lot of components. Is there anyway to override and apply custom logic to that event without changing much code?
On Chrome Mobile, the onContextMenu
event fires when you press and hold on an element. on Safari mobile, It doesn't work, so I have to apply custom logic. But currently I have a lot of components where I have already used onContextMenu
. Is there anyway to apply custom logic to onContextMenu
without changing much code?2 Replies
@CatNoir Solid just delegates events and doesn't have a way of intercepting them. The best you can do is add onTouchStart listener that can dispatch your onContextMenu event. https://playground.solidjs.com/anonymous/cb3e33f6-58aa-4280-9905-0b47246897a9
thanks <3 that worked perfectly