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

fix: enable browser fullscreen mode for the scorm x-block #23

Merged
merged 2 commits into from
Nov 15, 2022

Conversation

bydawen
Copy link
Contributor

@bydawen bydawen commented Sep 20, 2022

Fix to prevent incorrect rendering fullscreen mode when scorm x-block in MFE application.

@ihor-romaniuk
Copy link

@regisb Could you take a look at this PR, please?

@regisb
Copy link
Contributor

regisb commented Oct 3, 2022

Yes, this is on my todo-list.

@regisb regisb added the bug Something isn't working label Oct 3, 2022
Copy link
Contributor

@regisb regisb left a comment

Choose a reason for hiding this comment

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

The current implementation is a little problematic. On the other hand, I'm not quite sure how to fix it precisely. If you'd like, can you just make the new feature work for multiple scorm modules in the same unit? Then I'll take it from there.

openedxscorm/static/js/src/scormxblock.js Outdated Show resolved Hide resolved
} else {
// Find scorm-xblock content
const element = $('.scorm-xblock').get(0);
if (element.requestFullscreen) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I was not aware that there existed a native fullscreen API: https://developer.mozilla.org/en-US/docs/Web/API/Element/requestFullscreen

Could we ditch the ad-hoc fullscreen implementation that was until now part of the Scorm xblock implementation? Ideally, I'd like to keep only the new, native implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, fullscreen can be triggered only by the user. So we need to keep an old methods too, also it contains useful CSS styles and classes, we keep using to. 'Display in fullscreen mode on launch' feature are not working correctly in the MFEs, I added a note about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

See my review comment: #23 (review)

openedxscorm/static/js/src/scormxblock.js Show resolved Hide resolved
@@ -12,11 +60,13 @@ function ScormXBlock(runtime, element, settings) {
function enterFullscreen() {
$(element).find(".scorm-xblock").addClass("fullscreen-enabled");
triggerResize();
toggleScormFullScreen();
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a little bothered by the fact that the fullscreen logic is now split between the enterFullscreen/exitFullscreen/toggleScormFullScreen functions.

Also: shouldn't the triggerResize() function be called after fullscreen toggle?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Place triggerResize() function after fullscreen toggle, thx.

I'm a little bothered by the fact that the fullscreen logic is now split between the enterFullscreen/exitFullscreen/toggleScormFullScreen functions.

Answered above about this, the main problem, that it's prohibited to call native fullscreen by default only user allow to trigger it. And for now, I don't how any other proper solution to fix all this issue when we use scorm xblock in the MFE, sorry

Copy link
Contributor

@regisb regisb left a comment

Choose a reason for hiding this comment

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

Thanks again for your PR @bydawen, and sorry about the review delay.

This PR was made to make it possible to display scorm XBlocks in fullscreen when the learning MFE is enabled. I verified that it works as expected in Nutmeg.

The "native browser fullscreen" implementation makes the previous "fullscreen document" implementation kinda obsolete. However, we would still need to keep it to preserve the "fullscreen by default" feature. The problem is that this "fullscreen by default" feature will not work in the learning MFE -- because "fullscreen document" doesn't either. Since Nutmeg, we expect the learning MFE to be used by all platforms. The previous learning courseware is considered legacy. This means that "fullscreen by default" just does not work for most people. As a consequence I propose the following:

  1. Deprecate the "fullscreen by default" feature.
  2. Get rid of the "fullscreen document" implementation.

@bydawen I understand that the proposed changes may be outside of the scope of your PR. If you'd like to implement them in this PR, that's great! If not, just tell me and I'll do the changes myself.

@bydawen
Copy link
Contributor Author

bydawen commented Nov 15, 2022

Thanks again for your PR @bydawen, and sorry about the review delay.

This PR was made to make it possible to display scorm XBlocks in fullscreen when the learning MFE is enabled. I verified that it works as expected in Nutmeg.

The "native browser fullscreen" implementation makes the previous "fullscreen document" implementation kinda obsolete. However, we would still need to keep it to preserve the "fullscreen by default" feature. The problem is that this "fullscreen by default" feature will not work in the learning MFE -- because "fullscreen document" doesn't either. Since Nutmeg, we expect the learning MFE to be used by all platforms. The previous learning courseware is considered legacy. This means that "fullscreen by default" just does not work for most people. As a consequence I propose the following:

  1. Deprecate the "fullscreen by default" feature.
  2. Get rid of the "fullscreen document" implementation.

@bydawen I understand that the proposed changes may be outside of the scope of your PR. If you'd like to implement them in this PR, that's great! If not, just tell me and I'll do the changes myself.

Hello @regisb i'm sorry but may i ask you to do it? For now i'm not be able to do your proposal. I hope for your understanding.

@regisb
Copy link
Contributor

regisb commented Nov 15, 2022

Hello @regisb i'm sorry but may i ask you to do it?

Sure thing, no trouble at all.

@regisb regisb merged commit 0b3994b into overhangio:master Nov 15, 2022
@regisb regisb mentioned this pull request Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging this pull request may close these issues.

3 participants