diff options
author | Chocobozzz <me@florianbigard.com> | 2021-11-19 16:21:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-11-19 16:21:50 +0100 |
commit | 04868c13312c96f6c123716c9a04d6b03c544a4e (patch) | |
tree | dd98492584b0c9b5f10673de1915ad8fc5ff70b0 /client/src/assets | |
parent | 7aeb82ea7e5bf5291066c8382f349cea9eaaefb8 (diff) | |
download | PeerTube-04868c13312c96f6c123716c9a04d6b03c544a4e.tar.gz PeerTube-04868c13312c96f6c123716c9a04d6b03c544a4e.tar.zst PeerTube-04868c13312c96f6c123716c9a04d6b03c544a4e.zip |
Fix player menu keyboard navigation
Diffstat (limited to 'client/src/assets')
-rw-r--r-- | client/src/assets/player/videojs-components/settings-menu-button.ts | 3 | ||||
-rw-r--r-- | client/src/assets/player/videojs-components/settings-menu-item.ts | 11 |
2 files changed, 12 insertions, 2 deletions
diff --git a/client/src/assets/player/videojs-components/settings-menu-button.ts b/client/src/assets/player/videojs-components/settings-menu-button.ts index 50e25c004..c9990af1c 100644 --- a/client/src/assets/player/videojs-components/settings-menu-button.ts +++ b/client/src/assets/player/videojs-components/settings-menu-button.ts | |||
@@ -150,6 +150,9 @@ class SettingsButton extends Button { | |||
150 | this.dialog.show() | 150 | this.dialog.show() |
151 | 151 | ||
152 | this.setDialogSize(this.getComponentSize(this.menu)) | 152 | this.setDialogSize(this.getComponentSize(this.menu)) |
153 | |||
154 | const firstChild = this.menu.children()[0] | ||
155 | if (firstChild) firstChild.focus() | ||
153 | } | 156 | } |
154 | 157 | ||
155 | hideDialog () { | 158 | hideDialog () { |
diff --git a/client/src/assets/player/videojs-components/settings-menu-item.ts b/client/src/assets/player/videojs-components/settings-menu-item.ts index 67e71b4e2..31d42c456 100644 --- a/client/src/assets/player/videojs-components/settings-menu-item.ts +++ b/client/src/assets/player/videojs-components/settings-menu-item.ts | |||
@@ -101,7 +101,7 @@ class SettingsMenuItem extends MenuItem { | |||
101 | if (event.type === 'tap') { | 101 | if (event.type === 'tap') { |
102 | target = event.target | 102 | target = event.target |
103 | } else { | 103 | } else { |
104 | target = event.currentTarget | 104 | target = event.currentTarget || event.target |
105 | } | 105 | } |
106 | 106 | ||
107 | if (target?.classList.contains('vjs-back-button')) { | 107 | if (target?.classList.contains('vjs-back-button')) { |
@@ -124,7 +124,8 @@ class SettingsMenuItem extends MenuItem { | |||
124 | */ | 124 | */ |
125 | createEl () { | 125 | createEl () { |
126 | const el = videojs.dom.createEl('li', { | 126 | const el = videojs.dom.createEl('li', { |
127 | className: 'vjs-menu-item' | 127 | className: 'vjs-menu-item', |
128 | tabIndex: -1 | ||
128 | }) | 129 | }) |
129 | 130 | ||
130 | this.settingsSubMenuTitleEl_ = videojs.dom.createEl('div', { | 131 | this.settingsSubMenuTitleEl_ = videojs.dom.createEl('div', { |
@@ -170,6 +171,9 @@ class SettingsMenuItem extends MenuItem { | |||
170 | }, 0) | 171 | }, 0) |
171 | 172 | ||
172 | this.settingsButton.setDialogSize(this.size) | 173 | this.settingsButton.setDialogSize(this.size) |
174 | |||
175 | const firstChild = this.subMenu.menu.children()[0] | ||
176 | if (firstChild) firstChild.focus() | ||
173 | } else { | 177 | } else { |
174 | videojs.dom.addClass(this.settingsSubMenuEl_, 'vjs-hidden') | 178 | videojs.dom.addClass(this.settingsSubMenuEl_, 'vjs-hidden') |
175 | } | 179 | } |
@@ -244,6 +248,9 @@ class SettingsMenuItem extends MenuItem { | |||
244 | // this triggers CSS Transition event | 248 | // this triggers CSS Transition event |
245 | this.setMargin() | 249 | this.setMargin() |
246 | mainMenuEl.style.opacity = '1' | 250 | mainMenuEl.style.opacity = '1' |
251 | |||
252 | const firstChild = this.mainMenu.children()[0] | ||
253 | if (firstChild) firstChild.focus() | ||
247 | }, 0) | 254 | }, 0) |
248 | } | 255 | } |
249 | 256 | ||