-
Notifications
You must be signed in to change notification settings - Fork 426
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
Feature Request - Cross-platform "modify" for keydown filter. #654
Comments
Additional links and implementations for reference. We could use This may make it harder to use that symbol for some other seperator in the future though. Alpine.jsInterestingly, Alpine.js does not have this feature - https://alpinejs.dev/directives/on#keyboard-events HotkeyNot implemented, but has a PR up for this capability. Hotkey-jshttps://github.com/jaywcjlove/hotkeys-js Mousetrap
Tinykeys
|
- Adds `mod` to the `defaultSchema` which will resolve to `Meta` on a MacOS like device and `Control` on Windows like - Allows `mod` to be overridden at the schema keyMappings level if needed and used as a standalone key - Uses `mod` to be used as a key filter modifier for either `metaKey` or `ctrlKey` based on the resolved value - Add unit tests and documentation for the `mod` key, and an example to the slideshow page - Closes hotwired#654
PR up to implement this feature #715 |
- Adds `mod` to the `defaultSchema` which will resolve to `Meta` on a MacOS like device and `Control` on Windows like - Allows `mod` to be overridden at the schema keyMappings level if needed and used as a standalone key - Uses `mod` to be used as a key filter modifier for either `metaKey` or `ctrlKey` based on the resolved value - Add unit tests and documentation for the `mod` key, and an example to the slideshow page - Closes hotwired#654
- Adds `mod` to the `defaultSchema` which will resolve to `Meta` on a MacOS like device and `Control` on Windows like - Uses `mod` to be used as a key filter modifier for either `metaKey` or `ctrlKey` based on the resolved value - Add unit tests and documentation for the `mod` key, and an example to the slideshow page - Closes hotwired#654
- Adds `getModKey` to the `defaultSchema` which will resolve to `Meta` on a MacOS like device and `Control` on Windows like - Uses `mod` to be used as a key filter modifier for either `metaKey` or `ctrlKey` based on the resolved value - Add unit tests and documentation for the `mod` key, and an example to the slideshow page - Closes hotwired#654
- Adds `getModKey` to the `defaultSchema` which will resolve to `Meta` on a MacOS like device and `Control` on Windows like - Uses `mod` to be used as a key filter modifier for either `metaKey` or `ctrlKey` based on the resolved value - Add unit tests and documentation for the `mod` key, and an example to the slideshow page - Closes hotwired#654
- Adds `getModKey` to the `defaultSchema` which will resolve to `Meta` on a MacOS like device and `Control` on Windows like - Uses `mod` to be used as a key filter modifier for either `metaKey` or `ctrlKey` based on the resolved value - Add unit tests and documentation for the `mod` key, and an example to the slideshow page - Closes hotwired#654
- Adds `mod` to the `defaultSchema` which will resolve to `Meta` on a MacOS like device and `Control` on Windows like - Uses `mod` to be used as a key filter modifier for either `metaKey` or `ctrlKey` based on the resolved value - Add unit tests and documentation for the `mod` key, and an example to the slideshow page - Closes hotwired#654
I believe there is a common pattern to modify some keydown events using a different key on Mac and Windows operating systems. The one I see most commonly is using
CMD+Enter
on Mac andCTRL+Enter
on Windows in order to submit a form while typing in a textarea.I know that the
data-action
attribute on an element can take multiple actions; so, I could, in theory, achieve this as follows:But, considering that I'd want to use this pattern in many places, this seems verbose.
My next thought was to register a custom keydown filter -
mod
- as follows:... with the hope being that I could use something like
keydown.mod+enter
where it would be evaluated asmeta+enter
on Mac andctrl+enter
on Windows. But, unfortunately, it looks like modifier keys are handled separately from the custom key mappings.So, my thought would be to have Stimulus add a new modifier call
mod
ormodify
that would be the cross-platform evaluation.Anyway, just throwing that out there. I raised it on the Hotwired community forum, and I tried Googling for it, and I didn't see anyone discussing this anywhere.
The text was updated successfully, but these errors were encountered: