Skip to content
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

keydown event handlers for specific keys #219

Open
rx opened this issue Sep 13, 2019 · 0 comments
Open

keydown event handlers for specific keys #219

rx opened this issue Sep 13, 2019 · 0 comments

Comments

@rx
Copy link
Owner

rx commented Sep 13, 2019

You should be able to bind an event handler to a keydown event for a specific set of keys.
Examples - using enter key for submit, providing a keyboard friendly set of options.
Single key:

event :keypress, :enter do
    # event handler code goes here
end

An array of keys:

event :keypress, :enter, :g do
    # event handler code goes here
end

Having a modifier

event :keypress, :enter, {key: :g, modifiers: :ctrl} do
    # event handler code goes here
end

Having multiple modifiers

event :keypress, :enter, {key: :g, modifiers: [:shift,:ctrl]} do
    # event handler code goes here
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant