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 a timeout around the / search hotkey, so it doesn't type into the input #5702

Merged
merged 2 commits into from
Feb 22, 2019

Conversation

ndelangen
Copy link
Member

Issue: #5419

  • If you click anywhere in the Sidebar and press "/", you'll insert a '/' in the search box. This should not happen.

What I did

I added a 16ms timeout before giving the input-element focus.

I know it may not be the cleanest solution, but in order to cancel the event, I'd need access TO the event, and that would require more refactoring then I'm comfortable doing at this stage of the release.

@ndelangen ndelangen added this to the v5.0.0 milestone Feb 21, 2019
@ndelangen ndelangen self-assigned this Feb 21, 2019
@ndelangen ndelangen requested a review from domyen February 21, 2019 11:24
@tmeasday
Copy link
Member

Why does it need to be 16ms? Is 0 not enough?

@ndelangen
Copy link
Member Author

I expected the question, @tmeasday I just pick 16ms, as that over the years seems to be the magic number that seemed to always work in stupid cases like this.

It's roughly 1 animation frame.

I could do requestAnimationFrame instead, but was like 🤷‍♀️

@codecov
Copy link

codecov bot commented Feb 21, 2019

Codecov Report

Merging #5702 into next will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next    #5702      +/-   ##
==========================================
- Coverage   33.24%   33.24%   -0.01%     
==========================================
  Files         648      648              
  Lines        9363     9364       +1     
  Branches     1330     1355      +25     
==========================================
  Hits         3113     3113              
- Misses       5635     5636       +1     
  Partials      615      615
Impacted Files Coverage Δ
lib/ui/src/core/shortcuts.js 18.81% <0%> (-0.19%) ⬇️

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 81afc43...9ab127f. Read the comment docs.

@tmeasday
Copy link
Member

@ndelangen I guess I ask because I would have guessed 0 would be enough--just need to get the focus behind the event handling, which happens synchronously

@ndelangen
Copy link
Member Author

@tmeasday I changed it

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Great!

@ndelangen ndelangen merged commit d580d59 into next Feb 22, 2019
@ndelangen ndelangen deleted the fix/search-hotkey-keystroke branch February 22, 2019 16:01
shilman pushed a commit that referenced this pull request Feb 23, 2019
ADD a timeout around the `/` search hotkey, so it doesn't type into the input
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label Feb 23, 2019
@shilman shilman mentioned this pull request Feb 23, 2019
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug patch:done Patch/release PRs already cherry-picked to main/release branch ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants