Skip to content

Conversation

@joe-replin
Copy link
Contributor

#320 - was not a comprehensive solution for preventing forward scrubbing. Making another attempt.

Fix

New

  • Added forward scrubbing prevention that stops users from skipping ahead in videos/audio before they've watched that part
  • Added visual feedback (red flash) when users try to skip forward - automatically takes them to the furthest point they're allowed to view
  • Added keyboard prevention for forward navigation keys (right arrow, end, page down)

Testing

  1. Set _preventForwardScrubbing: true on a media component
  2. Play media and pause partway through
  3. Try clicking ahead on the progress bar - should result with red flash error
  4. Try dragging forward - should prevent with visual feedback
  5. Try using right arrow key - should prevent forward movement
  6. Complete the media - scrub blocker should disappear and allow normal scrubbing

js/mediaView.js Outdated
Comment on lines 566 to 570
scrubBlocker.classList.add('mejs__time-slider-blocker-error');
setTimeout(() => {
scrubBlocker.classList.remove('mejs__time-slider-blocker-error');
}, 150);
};
Copy link
Contributor

@swashbuck swashbuck Jul 30, 2025

Choose a reason for hiding this comment

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

This identical code appears three times in this file. Suggest making it a function and calling that each time.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I'm wondering about the accessibility of the 150ms red flash. If someone clicks or key presses multiple times, the red can flash in quick succession. Maybe this should only flash a maximum of once every 1 second?

https://www.w3.org/WAI/WCAG22/Understanding/three-flashes-or-below-threshold.html#dfn-general-flash-and-red-flash-thresholds

Copy link
Contributor Author

@joe-replin joe-replin Aug 4, 2025

Choose a reason for hiding this comment

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

This identical code appears three times in this file. Suggest making it a function and calling that each time.

Done. Good spot.

Also, I'm wondering about the accessibility of the 150ms red flash. If someone clicks or key presses multiple times, the red can flash in quick succession. Maybe this should only flash a maximum of once every 1 second?

https://www.w3.org/WAI/WCAG22/Understanding/three-flashes-or-below-threshold.html#dfn-general-flash-and-red-flash-thresholds

I'm not so sure about this call. It's not a continuous animation and the user would need to rapid-fire click to create a violation of the rule, which is highly unlikely. Also, the goal of the rule is to avoid triggering seizures. The size of the square doesn't seem large enough to fall under WCAG 2.3.1? Happy to implement something but I'm no so sure it is needed. I could be swayed the other direction pretty easily though.

@joe-replin
Copy link
Contributor Author

Noting here that this PR has been extensively tested and is currently a part of a large production release with no issues.

Comment on lines +514 to +530
.mejs__time-slider-blocker {
position: absolute;
top: 0;
right: 0;
height: 100%;
width: 0;
background-color: transparent;
pointer-events: auto;
z-index: 9999;
cursor: not-allowed;
transition: background-color 0.15s ease;

&.mejs__time-slider-blocker-error {
background-color: fade(@validation-error, 30%);
}
}

Copy link
Contributor

@swashbuck swashbuck Oct 9, 2025

Choose a reason for hiding this comment

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

Will you move these styles to mep-overrides.less? The mediaelementplayer.less file is a direct copy of the library's Less file and should not be modified. Otherwise, the styles may be overridden during a library update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Needs Reviewing

Development

Successfully merging this pull request may close these issues.

Locked player bar still triggers events Backwards scrubbing is broken

3 participants