Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-85151

Focus lost / misplaced when closing fullscreen video player

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.4.7, 5.0
    • Media
    • MOODLE_404_STABLE, MOODLE_500_STABLE

      Had an accessibility audit on our project (4.4.7+) and this bug was found by the a11y team. Replicated and investigated it on a "clean install" (5.0rc2).

      When a page has a video player, when we enter the fullscreen mode by clicking the Fullscreen button and then exit the fullscreen mode by clicking the Fullscreen button, the focus is lost to the Course Index drawer button. Strangely, from this point on, any action on the video player results in a loss of focus to the Course Index drawer button. The problem only occurs when the button is clicked to exit the fullscreen mode; if the ESC key is used, the problem doesn't occur.

      Steps to reproduce :

      1. In a course, create a page with a Multimedia video, eg. https://www.youtube.com/watch?v=JdLkb2dderM
      2. Save and display the page
      3. Start the video and click on the Fullscreen button
      4. Close the fullscreen mode by clicking the Fullscreen button (do not use the ESC key)
      5. The focus gets set to the Course Index drawer button.
      6. After any action in the video player (eg. Play, Playback Rate), the focus is set on the Course Index drawer button.

      Investigation :

      The problem seems to come somewhere from /theme/boost/amd/src/drawers.js :

      1. In registerListeners() (l.719), an event listener is registered to the resize event (l.820).
      2. closeOnResizeListener() is called whenever the fullscreen mode is closed.
      3. getBackdrop() (l.81) gets then called, in which Drawers.closeAllDrawers() is called (l.92).
      4. closeAllDrawers() (l.639) then loops on every drawer instance, calling closeDrawer().

      The closeDrawer() function has a parameter focusOnOpenButton that can be declared at false when called, circumventing this problem. Not beeing aware of the details and intentions of the drawers.js script, I can't establish exactly what/when/where should determine the focusOnOpenButton value to prevent the issue.

      Related issues

      This seems to be the same situation as described in those two tickets, but with a little bit more context and no "distractions" from an external plugin :

        1. image-2025-04-09-14-28-42-559.png
          148 kB
          Yves Hélie
        2. image-2025-04-09-14-29-07-712.png
          4 kB
          Yves Hélie
        3. image-2025-04-09-14-29-35-030.png
          17 kB
          Yves Hélie

            Unassigned Unassigned
            yveshelie Yves Hélie
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.