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

Add support for scoped hotkey #49

Merged
merged 1 commit into from
Sep 23, 2021
Merged

Add support for scoped hotkey #49

merged 1 commit into from
Sep 23, 2021

Conversation

khiga8
Copy link
Contributor

@khiga8 khiga8 commented Sep 21, 2021

What

Add support for scoped hotkeys when the data-hotkey-scope attribute is specified.

For example:

<!-- button click can only be triggered when hotkey is pressed from textarea#text-area-1 -->
<button data-hotkey="Control+P" data-hotkey-scope="text-area-1"> Button 1 </button>
<textarea id="text-area-1"> </textarea>
<textarea id="text-area-2"> </textarea>

Why

Currently github/hotkey only supports global hotkeys but increasingly we are seeing a need for hotkey actions that can be triggered from a textarea. Rather than relying on custom hotkey implementations for scoped shortcuts, we should expand this library.

Co-authored-by: @keithamus

@khiga8 khiga8 requested a review from a team as a code owner September 21, 2021 03:44
examples/index.html Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
test/test.js Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
@khiga8 khiga8 force-pushed the kh-scope branch 2 times, most recently from accf2c1 to 490fc7f Compare September 23, 2021 16:54
Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
@khiga8
Copy link
Contributor Author

khiga8 commented Sep 23, 2021

paired with @keithamus!

Ready for another review 🚀

@khiga8 khiga8 merged commit e543eda into main Sep 23, 2021
@khiga8 khiga8 deleted the kh-scope branch September 23, 2021 17:41
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

Successfully merging this pull request may close these issues.

None yet

3 participants