Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No change event fired Safari 12.1 #134

Closed
GlenHughes opened this issue Apr 16, 2019 · 3 comments
Closed

No change event fired Safari 12.1 #134

GlenHughes opened this issue Apr 16, 2019 · 3 comments

Comments

@GlenHughes
Copy link

GlenHughes commented Apr 16, 2019

Hello,

The change event is no longer being fired in Safari 12.1 on Mac OS. This code is running inside a custom web component. This is my code (stripped down just to show how I am using your module):
`import screenfull from "screenfull"

class ScreenFullScreen {
constructor() {
screenfull.on("change", () => {
console.warn("Am I fullscreen?", screenfull.isFullscreen ? "Yes" : "No")
})
}

new ScreenFullScreen()`

The page does go into fullscreen but this event never gets captured. This app is running in a webpack environment.

@jayjnu
Copy link

jayjnu commented May 2, 2019

I encountered the similar problem. In my case the change event is not fired both on the latest chrome and safari.

I found out this line https://github.com/sindresorhus/screenfull.js/blob/35c1a9eb34fd1c1a652b01e82b8d9a8357a679a6/src/screenfull.js#L64 is no longer effective.

That logic assumes if document has exitFullscreen property, it implements the standard API.

I tested if that logic still applies to the latest chrome, and it turns out the webkit implemented exitFullScreen, but the 'fullscreenchange' event has not been introduced yet.

It would be great if I could submit a pr for this matter. I am trying to figure out the cleanest way to address this problem.

@alejandroiglesias
Copy link

alejandroiglesias commented May 8, 2019

The change event is being fired for me on Safari 12.1 and Chrome 74.

@peterkogo
Copy link

Just an idea: Maybe try to move the code from the constructor to onComponentDidMount.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants