metafizzy / metafizzy/flickity-fullscreen

Fullscreen overlay mode does not exit on ESC key

Open
#43 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
49
Forks
16
PR merge metrics
No merged PRs in 30d

Description

First of all: many thanks for this cool library, Flickity really rocks. 🌟

While playing with the fullscreen plugin I encountered a problem with keyboard handling, though.
The Escape key doesn't close the overlay.

Here's the code: https://github.com/metafizzy/flickity-fullscreen/blob/master/fullscreen.js#L92

However, Flickity.keyboardHandlers doesn't expect the number from `event.which`, but apparently the string from `event.key`: https://github.com/metafizzy/flickity/blob/master/js/core.js#L787

Maybe that behavior changed at some point in the past...

Following fixes it for me:
```javascript
// ESC key closes full screen
Flickity.keyboardHandlers['Escape'] = function() {
this.exitFullscreen();
};
```
Is there interest in a pull request, or is this trivial change not worth it, anyway?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in fullscreen.js at line 92 and compare its keyboard handling with Flickity's keyboardHandlers in core.js at line 787. Reproduce the fullscreen overlay behavior, then verify that pressing Escape exits the overlay and that the relevant keyboard handler uses the expected event value.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.