naumch1k / one-fall

Landing page for ONE FALL, Salem-based melodic punk and hardcore quartet has rapidly made a mark in New England
https://develop--one-fall.netlify.app/
0 stars 0 forks source link

BUGFIX: Prevent the default behavior of ESC key exiting full-screen on modal #14

Closed naumch1k closed 1 week ago

naumch1k commented 3 weeks ago

Description

Added e.preventDefault() to the closeByEsc callback to prevent Safari and Firefox from exiting full-screen mode when using ESC key to close the modal.

Task Link

This pull request resolves #11

netlify[bot] commented 3 weeks ago

Deploy Preview for one-fall ready!

Name Link
Latest commit c04e10b3173d95a705a03e6db01672f088e9ecaa
Latest deploy log https://app.netlify.com/sites/one-fall/deploys/668f2189d28fa5000821d1a8
Deploy Preview https://deploy-preview-14--one-fall.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

naumch1k commented 3 weeks ago

@Yura33-dev, please take a look at this tiny pull request when you have time 🙏

Yura33-dev commented 2 weeks ago

@Yura33-dev, please take a look at this tiny pull request when you have time 🙏

Hello, @naumch1k ! Everythink works fine, but now I can`t close modal window (merch or gallery) by keyboard (Enter key or Space key). Only ESC key is way to close modal window. Is it ok?

naumch1k commented 2 weeks ago

@Yura33-dev Nope, it is not ok 😬 Great catch! I'll look into it and find a way to fix

naumch1k commented 2 weeks ago

@Yura33-dev I moved e.preventDefault() inside the if statement to ensure it only affects the 'Escape' key and not other keys. Could you please recheck if it works as intended now?

if (e instanceof KeyboardEvent && e.code === 'Escape') {
  e.preventDefault()
  closeModal()
}