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

do not display fullscreen control on unsupported devices #4786 #4838

Merged
merged 5 commits into from
Jun 21, 2017

Conversation

stepankuzmin
Copy link
Contributor

@stepankuzmin stepankuzmin commented Jun 15, 2017

Do not display fullscreen control on unsupported devices according to #4786

I think, that it would be useful to warn the user if the device does not support fullscreen mode.

@@ -4,6 +4,8 @@ const DOM = require('../../util/dom');
const util = require('../../util/util');
const window = require('../../util/window');

const className = 'mapboxgl-ctrl';
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of another global variable could you store this as this._className?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure!

Copy link
Contributor

@mollymerp mollymerp left a comment

Choose a reason for hiding this comment

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

According to my interpretation of the docs, I think we should be checking for [[prefix]]fullscreenEnabled, not requestFullscreen https://developer.mozilla.org/en-US/docs/Web/API/Document/fullscreenEnabled

This will not only check browser support, but also whether or not the current element is available in full-screen mode

if (this._checkFullscreenSupport()) {
this._setupUI();
} else {
util.warnOnce('This device does not support fullscreen mode.');
Copy link
Contributor

Choose a reason for hiding this comment

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

we should also set display:none; for the container when fullscreen is not supported

@stepankuzmin
Copy link
Contributor Author

Done!

@mollymerp
Copy link
Contributor

Thanks for the contribution @stepankuzmin! I think this is almost ready to go, but it would be great to see a unit test that confirms the control container gets added to the map when fullscreen is enabled.

@stepankuzmin
Copy link
Contributor Author

Thanks for the review, @mollymerp! I've updated the PR.

@mollymerp
Copy link
Contributor

Thanks again @stepankuzmin!

@dieterdreist
Copy link

There's a problem now on Firefox as on Safari mobile: does not display the Fullscreen icon any more and logs "This device does not support fullscreen mode." to the console. Still working on Safari (desktop). Until api v. 0.38.0 it worked in Firefox as well.

@aparajita
Copy link
Contributor

@dieterdreist Fullscreen was never supported on mobile devices. Mapbox was mistakenly showing the control, but it couldn't have worked, because the fullscreen API isn't supported (except for video and audio elements).

http://caniuse.com/#feat=fullscreen

@jfirebaugh
Copy link
Contributor

Fixed Firefox in #5272.

@stepankuzmin stepankuzmin deleted the 4786-fullscreen branch October 2, 2017 16:27
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

Successfully merging this pull request may close these issues.

5 participants