Making withtooltip close on escape#65097
Merged
Merged
Conversation
🖼️ Storybook Visual Comparison Report✅ No Storybook eyes differences detected! |
fisher-alice
approved these changes
Apr 7, 2025
| const handleKeyDown = (event: KeyboardEvent) => { | ||
| if (event.key === 'Escape' && !event.defaultPrevented) { | ||
| if (event.target instanceof HTMLElement) { | ||
| event.target.blur(); // Remove focus from the container |
Contributor
There was a problem hiding this comment.
Q about blur in general - is this what we'll need to use to address https://codedotorg.atlassian.net/browse/CT-1164?
Contributor
Author
There was a problem hiding this comment.
Blur could possibly work! I'm not entirely sure how it's getting focus again so it might be a matter of deleting code.. we'll have to get in there and find out😃
8 tasks
Erin007
pushed a commit
that referenced
this pull request
Apr 15, 2025
* making withtooltip close on escape * we actually want to keep focus on the button I think
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Warning!!
The AP CSP Create Performance Task is in progress. The most critical dates are from April 3 - April 30, 2025. Please consider any risk introduced by this PR that could affect our students taking AP CSP. Code.org students taking AP CSP primarily use App Lab for their Create Task, however a small percent use Game Lab. Carefully consider whether your change has any risk of alterering, changing, or breaking anything in these two labs. Even small changes, such as a different button color, are considered significant during this time period. Reach out to the Student Learning team or Curriculum team for more details.
There were a couple tiny issues preventing this from working before- I tried with limiting these updates and none (attaching to the document instead of window, checking for preventDefault) worked on its own.
Additionally, I decided in the case of something like codeMirror, we won't want to unfocus something if we hit escape to close a tooltip.
Screen.Recording.2025-04-07.at.1.40.21.PM.mov
Links
Testing story
Deployment strategy
Follow-up work
Privacy
Security
Caching
PR Checklist: