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 Escape shortcut to hide adder #3553

Merged
merged 1 commit into from Jul 6, 2021
Merged

Add Escape shortcut to hide adder #3553

merged 1 commit into from Jul 6, 2021

Conversation

LMS007
Copy link
Contributor

@LMS007 LMS007 commented Jul 2, 2021

The adder now hides when the escape key is pressed. (WCAG 2.1 criterion 1.4.13)


Note: Low priority

fixes hypothesis/product-backlog#1128

relates to hypothesis/product-backlog#1114

Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I had a look around for examples of similar behavior in other apps and found that Google Docs has similar behavior in the popover it displays when text with a spelling error or link is selected.

it('hides the adder when `Escape` shortcut is pressed', () => {
adder.annotationsForSelection = ['ann1'];
showAdder();
triggerShortcut('Escape');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not terribly consistent about this in some test suites, but as a rule of thumb once tests exceed 4 or 5 lines I find it helps readability to separate the setup/action being tested/assertions (aka Arrange/Act/Assert), assuming there is a clear separation between these phases. In this case, that means adding new blank lines before and after the triggerShortcut call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

roger that

The adder now hides when the escape key is pressed. (WCAG 2.1 criterion 1.4.13)
@codecov
Copy link

codecov bot commented Jul 6, 2021

Codecov Report

Merging #3553 (7938d60) into master (5950bb2) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3553   +/-   ##
=======================================
  Coverage   98.60%   98.61%           
=======================================
  Files         211      211           
  Lines        7696     7701    +5     
  Branches     1749     1751    +2     
=======================================
+ Hits         7589     7594    +5     
  Misses        107      107           
Impacted Files Coverage Δ
src/annotator/adder.js 98.09% <100.00%> (+0.05%) ⬆️
src/annotator/components/AdderToolbar.js 95.45% <100.00%> (+0.45%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5950bb2...7938d60. Read the comment docs.

@LMS007 LMS007 merged commit edf3a10 into master Jul 6, 2021
@LMS007 LMS007 deleted the add-esc-to-adder branch July 6, 2021 17:50
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.

Allow users to dismiss annotation adder without moving pointer or keyboard focus (WCAG 2.1 criterion 1.4.13)
2 participants