Skip to content

Making withtooltip close on escape#65097

Merged
hannahbergam merged 2 commits into
stagingfrom
hbergam/tooltip-close-on-esc
Apr 8, 2025
Merged

Making withtooltip close on escape#65097
hannahbergam merged 2 commits into
stagingfrom
hbergam/tooltip-close-on-esc

Conversation

@hannahbergam

@hannahbergam hannahbergam commented Apr 7, 2025

Copy link
Copy Markdown
Contributor

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:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@hannahbergam hannahbergam requested review from a team and levadadenys April 7, 2025 20:43

@molly-moen molly-moen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎉

@github-actions

github-actions Bot commented Apr 7, 2025

Copy link
Copy Markdown

🖼️ Storybook Visual Comparison Report

✅ No Storybook eyes differences detected!

@fisher-alice fisher-alice left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice!

const handleKeyDown = (event: KeyboardEvent) => {
if (event.key === 'Escape' && !event.defaultPrevented) {
if (event.target instanceof HTMLElement) {
event.target.blur(); // Remove focus from the container

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Q about blur in general - is this what we'll need to use to address https://codedotorg.atlassian.net/browse/CT-1164?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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😃

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@hannahbergam hannahbergam merged commit 054ebc7 into staging Apr 8, 2025
@hannahbergam hannahbergam deleted the hbergam/tooltip-close-on-esc branch April 8, 2025 19:45
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants