From 0e1621f4f729a31f5ca750ab97b08fcccb9a7c03 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Thu, 15 Jan 2026 18:06:21 -0600 Subject: [PATCH] js: Use the `aria-pressed` attribute on fullscreen This adds the `aria-pressed` attribute for the fullscreen button. The value toggles in the enterFullScreen/exitFullScreen methods. Notably, the value is always `false` in Safari / iOS WebKit. This is because the WebKit's native fullscreen view disable access to the DOM and all elements. There is no way to interact or manipulate them from the fullscreen view. This should be fine, because that means any time the user can interact with them, the pressed value should be false. Closes: ADA-674 --- app/assets/javascripts/mediaelement-and-player.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/mediaelement-and-player.js b/app/assets/javascripts/mediaelement-and-player.js index 5373f18..292768f 100644 --- a/app/assets/javascripts/mediaelement-and-player.js +++ b/app/assets/javascripts/mediaelement-and-player.js @@ -1317,7 +1317,7 @@ Object.assign(_player2.default.prototype, { fullscreenTitle = (0, _general.isString)(t.options.fullscreenText) ? t.options.fullscreenText : _i18n2.default.t('mejs.fullscreen'), fullscreenBtn = _document2.default.createElement('div'); fullscreenBtn.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'fullscreen-button'; - fullscreenBtn.innerHTML = (0, _generate.generateControlButton)(t.id, fullscreenTitle, fullscreenTitle, '' + t.media.options.iconSprite, ['icon-fullscreen', 'icon-unfullscreen'], '' + t.options.classPrefix); + fullscreenBtn.innerHTML = (0, _generate.generateControlButton)(t.id, fullscreenTitle, fullscreenTitle, '' + t.media.options.iconSprite, ['icon-fullscreen', 'icon-unfullscreen'], '' + t.options.classPrefix, null, '', false); t.addControlElement(fullscreenBtn, 'fullscreen'); fullscreenBtn.addEventListener('click', function () { @@ -1476,6 +1476,7 @@ Object.assign(_player2.default.prototype, { if (t.fullscreenBtn) { (0, _dom.removeClass)(t.fullscreenBtn, t.options.classPrefix + 'fullscreen'); (0, _dom.addClass)(t.fullscreenBtn, t.options.classPrefix + 'unfullscreen'); + t.fullscreenBtn.querySelector('button').setAttribute('aria-pressed', true); } t.setControlsSize(); @@ -1539,6 +1540,7 @@ Object.assign(_player2.default.prototype, { if (t.fullscreenBtn) { (0, _dom.removeClass)(t.fullscreenBtn, t.options.classPrefix + 'unfullscreen'); (0, _dom.addClass)(t.fullscreenBtn, t.options.classPrefix + 'fullscreen'); + t.fullscreenBtn.querySelector('button').setAttribute('aria-pressed', false); } t.setControlsSize();