-
Notifications
You must be signed in to change notification settings - Fork 57
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 hotkey to code block button #37
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1f58670
Ensure hotkeys are case sensitive
aaron-tdouble b540e7c
Add hotkey for code block
aaron-tdouble 5c1807c
Add testing for osx keydown browser bug
aaron-tdouble 891f80d
Add test for uppercased case sensitivity
aaron-tdouble 53b93f2
Change code block hotkey from C -> E
aaron-tdouble File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this change is needed. I can revert this block locally and the tests still run green.
The case-sensitivity is already backed in since we do strict equality of the key pressed and the
hotkey
attribute.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@koddsson
I must be doing something wrong because this test (correctly) fails for me onmain
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it do for you on the example page?
If I
cmd-b
orcmd-B
(cmd-shift-b), it bolds the text. I would expect it only to respond to a lowercaseb
.This is true for me on Chrome, Safari, and Firefox. Also true for someone that used Microsoft Edge browser on Mac.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@koddsson Wait. Scratch my first comment above. I was testing the wrong thing. Let me look into that in the morning, but my second comment ☝️ still stands. I'm curious how this behaves for you.
I agree with you that it should work as written. All the docs I read say that
key
will always return the actual key being pressed (as in, the uppercaseB
or lowercaseb
), but when I inspect the event in the debugger, I never see an uppercase letter forkey
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⌘+B is a global shortcut on my mac that launches a application 😄
But yeah if I turn that off then I can bold with both. This is unexpected but apparently, if you are holding the meta key down
KeyboardEvent.key
will always be lowercase.I made a little site to test out the
keydown
handler here.Getting the tests to fail when this block is removed would be good though 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah... this is a specific edge case with macos reporting lower case keys for specifically
cmd+shift
. See https://bugs.webkit.org/show_bug.cgi?id=174782 & https://bugs.chromium.org/p/chromium/issues/detail?id=747358There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good finds and information, @koddsson and @keithamus. I'll work on getting a breaking test on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.