Skip to content

✨ [bento][amp-sidebar] Allow esc key to close sidebar#32431

Merged
krdwan merged 6 commits intoampproject:masterfrom
krdwan:sidebar
Feb 18, 2021
Merged

✨ [bento][amp-sidebar] Allow esc key to close sidebar#32431
krdwan merged 6 commits intoampproject:masterfrom
krdwan:sidebar

Conversation

@krdwan
Copy link
Copy Markdown
Contributor

@krdwan krdwan commented Feb 4, 2021

Sidebar tracker: #31366


Update 2/10
This is dependent on: #32584
On hold until dependency is completed!


When sidebar opens, attach an eventListener to check for the 'esc' key being pressed and close the sidebar if it is pressed.

How does this work?

  1. eventListener gets attached once sidebar element is rendered (done via useEffect (async))
  2. If it is clicked mid-animation, the close api will handle reversing the animation

@krdwan krdwan requested review from caroqliu and dvoytenko February 4, 2021 16:55
@krdwan krdwan requested a review from dvoytenko February 4, 2021 21:41
Copy link
Copy Markdown
Contributor

@caroqliu caroqliu left a comment

Choose a reason for hiding this comment

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

left a couple comments, looks so much more clear now!

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.

5 participants