Skip to content

Commit 8fa9514

Browse files
committed
Simplifies keyboard shortcuts overlay
Removes the "Show all/Show fewer" toggle button from the keyboard shortcuts overlay for a cleaner and more streamlined user experience. The overlay now displays all shortcuts by default, improving discoverability and reducing user interaction.
1 parent d77b5dd commit 8fa9514

File tree

3 files changed

+17
-56
lines changed

3 files changed

+17
-56
lines changed

ui/component/viewers/videoViewer/internal/keyboard-shortcuts-overlay.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ function buildOverlayMarkup() {
5050
<div class="vjs-shortcuts-header">
5151
<div class="vjs-shortcuts-title">${__('Keyboard shortcuts')}</div>
5252
<div class="vjs-shortcuts-actions">
53-
<button type="button" class="vjs-shortcuts-toggle"></button>
5453
<button type="button" class="vjs-shortcuts-close" aria-label="${__('Close')}">${__('Close')}</button>
5554
</div>
5655
</div>
@@ -83,23 +82,7 @@ export function ensureKeyboardShortcutsOverlay(player) {
8382
playerEl.appendChild(overlayEl);
8483

8584
const closeButton = overlayEl.querySelector('.vjs-shortcuts-close');
86-
const toggleButton = overlayEl.querySelector('.vjs-shortcuts-toggle');
87-
8885
let isOpen = false;
89-
let isExpanded = false;
90-
91-
const updateToggleLabel = () => {
92-
if (toggleButton) {
93-
toggleButton.textContent = __(isExpanded ? 'Show fewer' : 'Show all');
94-
toggleButton.setAttribute('aria-expanded', String(isExpanded));
95-
}
96-
};
97-
98-
const setExpanded = (expanded) => {
99-
isExpanded = expanded;
100-
overlayEl.classList.toggle('vjs-shortcuts-overlay--expanded', isExpanded);
101-
updateToggleLabel();
102-
};
10386

10487
const open = () => {
10588
if (isOpen) return;
@@ -124,16 +107,10 @@ export function ensureKeyboardShortcutsOverlay(player) {
124107
isOpen ? close() : open();
125108
};
126109

127-
updateToggleLabel();
128-
129110
if (closeButton) {
130111
closeButton.addEventListener('click', () => close());
131112
}
132113

133-
if (toggleButton) {
134-
toggleButton.addEventListener('click', () => setExpanded(!isExpanded));
135-
}
136-
137114
overlayEl.addEventListener('click', (event) => {
138115
if (event.target === overlayEl) close();
139116
});
@@ -144,7 +121,6 @@ export function ensureKeyboardShortcutsOverlay(player) {
144121
open,
145122
close,
146123
toggle,
147-
setExpanded,
148124
isOpen: () => isOpen,
149125
};
150126

ui/component/viewers/videoViewer/internal/keyboard-shortcuts-overlay.scss

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,27 @@
3333

3434
.vjs-shortcuts-header {
3535
align-items: center;
36-
display: flex;
37-
flex-direction: row;
38-
flex-wrap: wrap;
39-
gap: 10px;
40-
justify-content: flex-start;
41-
margin-bottom: 8px;
36+
column-gap: 8px;
37+
display: grid;
38+
grid-template-columns: minmax(0, 1fr) auto;
39+
margin-bottom: 4px;
40+
row-gap: 4px;
4241
}
4342

4443
.vjs-shortcuts-actions {
4544
align-items: center;
4645
display: flex;
47-
gap: 8px;
48-
flex-wrap: wrap;
49-
justify-content: flex-start;
46+
gap: 6px;
47+
justify-content: flex-end;
48+
justify-self: end;
5049
}
5150

5251
.vjs-shortcuts-title {
53-
align-self: flex-start;
5452
font-size: 16px;
5553
font-weight: 600;
5654
}
5755

58-
.vjs-shortcuts-close,
59-
.vjs-shortcuts-toggle {
56+
.vjs-shortcuts-close {
6057
background: transparent;
6158
border: 1px solid rgba(255, 255, 255, 0.2);
6259
border-radius: 6px;
@@ -70,18 +67,14 @@
7067
box-sizing: border-box;
7168
display: grid;
7269
gap: 6px;
73-
grid-template-columns: 1fr;
70+
column-gap: 32px;
71+
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
7472
min-height: 0;
7573
overflow-x: hidden;
7674
overflow-y: auto;
7775
width: 100%;
7876
}
7977

80-
.vjs-shortcuts-overlay--expanded .vjs-shortcuts-body {
81-
column-gap: 52px;
82-
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
83-
}
84-
8578
.vjs-shortcuts-list {
8679
box-sizing: border-box;
8780
display: grid;
@@ -93,12 +86,8 @@
9386
width: 100%;
9487
}
9588

96-
.vjs-shortcuts-overlay--expanded .vjs-shortcuts-list--secondary {
97-
display: grid;
98-
}
99-
10089
.vjs-shortcuts-list--secondary {
101-
display: none;
90+
display: grid;
10291
}
10392

10493
.vjs-shortcuts-item {
@@ -139,28 +128,22 @@
139128
line-height: 1.15;
140129
}
141130

142-
.vjs-shortcuts-overlay--expanded .vjs-shortcuts-card {
143-
max-width: 720px;
144-
width: min(92vw, 720px);
145-
}
146-
147131
@media (max-width: 720px) {
148132
.vjs-shortcuts-card {
149133
max-height: calc(100% - 16px);
150134
padding: 12px 12px;
151135
width: calc(100% - 24px);
152136
}
153137

154-
.vjs-shortcuts-overlay--expanded .vjs-shortcuts-body {
138+
.vjs-shortcuts-body {
155139
grid-template-columns: 1fr;
156140
}
157141

158142
.vjs-shortcuts-title {
159143
font-size: 14px;
160144
}
161145

162-
.vjs-shortcuts-close,
163-
.vjs-shortcuts-toggle {
146+
.vjs-shortcuts-close {
164147
font-size: 11px;
165148
padding: 5px 8px;
166149
}
@@ -175,3 +158,6 @@
175158
}
176159
}
177160
}
161+
.vjs-shortcuts-actions {
162+
justify-self: end;
163+
}

ui/component/viewers/videoViewer/internal/videojs.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ export type Player = {
8484
open: () => void,
8585
close: () => void,
8686
toggle: (forceState?: boolean) => void,
87-
setExpanded: (expanded: boolean) => void,
8887
isOpen: () => boolean,
8988
},
9089
toggleKeyboardShortcutsOverlay?: (forceState?: boolean) => void,

0 commit comments

Comments
 (0)