elm-pointer-events icon indicating copy to clipboard operation
elm-pointer-events copied to clipboard

Add meta key in Mouse Event

Open loicknuchel opened this issue 2 years ago • 2 comments

Hi,

I saw that meta key is not provided on purpose for Mouse Event because it's not supported on Linux (https://github.com/mpizenberg/elm-pointer-events/blob/master/src/Html/Events/Extra/Mouse.elm#L110) Still, on Mac, this key is the most used one, like the ctrl key in Linux, and with this choice I can't provide a ctrl+click experience on Mac.

Do you have a workaround for that? (except from opt-out from the decoder). Would you consider changing that or providing a workaround?

Thanks

loicknuchel avatar Jun 09 '22 20:06 loicknuchel

Hi Loïc, I haven't thought too much about it. I'm not super available right now as I'm changing jobs and changing cities (moving from Caen to Toulouse). But if you have ideas on how to improve that in a way that is cross platform don't hesitate to let me know. We can also take few minutes to discuss this over a call (let me know via slack is probably the easiest).

Otherwise, my feeling is that I see elm-pointer-events as an easy to use package to prototype UXs, but then I usually just extract the decoders I need from the code to have something more tailored and performant. So don't hesitate to just extract and copy paste whatever you need.

On Thu, Jun 9, 2022, 22:12 Loïc Knuchel @.***> wrote:

Hi,

I saw that meta key is not provided on purpose for Mouse Event because it's not supported on Linux ( https://github.com/mpizenberg/elm-pointer-events/blob/master/src/Html/Events/Extra/Mouse.elm#L110 ) Still, on Mac, this key is the most used one, like the ctrl key in Linux, and with this choice I can't provide a ctrl+click experience on Mac.

Do you have a workaround for that? (except from opt-out from the decoder). Would you consider changing that or providing a workaround?

Thanks

— Reply to this email directly, view it on GitHub https://github.com/mpizenberg/elm-pointer-events/issues/26, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWFOCJPT5CODMFFEIP32BLVOJF2FANCNFSM5YLIHD7A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mpizenberg avatar Jun 10 '22 13:06 mpizenberg

If we want to add it, one option is to decode and fall back to either False or the Ctrl key.

mpizenberg avatar Jun 13 '22 10:06 mpizenberg

Also note that ctrl+click on macOS opens the context menu and does not trigger any event in JavaScript.

Alternatives:

  • Also remove support for ctrl since it’s not cross platform either.
  • Expose both ctrl and meta/cmd and let the user handle it.
  • Expose a single field called something that is ctrl || meta. That’s how I usually implement keyboard shortcuts on the web to support both Windows/Linux and macOS at the same time. Not sure if this excludes any use cases though.

Thanks for the pointer (no pun intended) about copying the parts I need and only using this for prototyping. The app I’m working on is definitely graduating from prototype stage now and needs cmd shortcuts on macOS.

lydell avatar Apr 26 '23 06:04 lydell

The option I prefer would be to support both ctrl and meta, with decoders defaulting to false if the key is not available. If anyone wants to implement this, I'd be happy to include it.

mpizenberg avatar Apr 29 '23 18:04 mpizenberg

Thanks both, for the issue and PR. The update with the support of the meta key is now published as version 5.0.0

mpizenberg avatar Apr 29 '23 21:04 mpizenberg