Skip to content

Commit 0e1621f

Browse files
committed
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
1 parent 6ccaee3 commit 0e1621f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

app/assets/javascripts/mediaelement-and-player.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ Object.assign(_player2.default.prototype, {
13171317
fullscreenTitle = (0, _general.isString)(t.options.fullscreenText) ? t.options.fullscreenText : _i18n2.default.t('mejs.fullscreen'),
13181318
fullscreenBtn = _document2.default.createElement('div');
13191319
fullscreenBtn.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'fullscreen-button';
1320-
fullscreenBtn.innerHTML = (0, _generate.generateControlButton)(t.id, fullscreenTitle, fullscreenTitle, '' + t.media.options.iconSprite, ['icon-fullscreen', 'icon-unfullscreen'], '' + t.options.classPrefix);
1320+
fullscreenBtn.innerHTML = (0, _generate.generateControlButton)(t.id, fullscreenTitle, fullscreenTitle, '' + t.media.options.iconSprite, ['icon-fullscreen', 'icon-unfullscreen'], '' + t.options.classPrefix, null, '', false);
13211321
t.addControlElement(fullscreenBtn, 'fullscreen');
13221322

13231323
fullscreenBtn.addEventListener('click', function () {
@@ -1476,6 +1476,7 @@ Object.assign(_player2.default.prototype, {
14761476
if (t.fullscreenBtn) {
14771477
(0, _dom.removeClass)(t.fullscreenBtn, t.options.classPrefix + 'fullscreen');
14781478
(0, _dom.addClass)(t.fullscreenBtn, t.options.classPrefix + 'unfullscreen');
1479+
t.fullscreenBtn.querySelector('button').setAttribute('aria-pressed', true);
14791480
}
14801481

14811482
t.setControlsSize();
@@ -1539,6 +1540,7 @@ Object.assign(_player2.default.prototype, {
15391540
if (t.fullscreenBtn) {
15401541
(0, _dom.removeClass)(t.fullscreenBtn, t.options.classPrefix + 'unfullscreen');
15411542
(0, _dom.addClass)(t.fullscreenBtn, t.options.classPrefix + 'fullscreen');
1543+
t.fullscreenBtn.querySelector('button').setAttribute('aria-pressed', false);
15421544
}
15431545

15441546
t.setControlsSize();

0 commit comments

Comments
 (0)