Skip to content

Commit 9d4e4d0

Browse files
authored
fix(UI): Fix position of menus and tooltips when the seekbar is missing (#8639)
1 parent c6b53b3 commit 9d4e4d0

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

ui/controls.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,11 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
12131213
for (const menu of this.menus_) {
12141214
menu.classList.add('shaka-low-position');
12151215
}
1216+
// Tooltips need to be positioned lower if the seekbar is absent.
1217+
const controlsButtonPanel = this.controlsButtonPanel_;
1218+
if (controlsButtonPanel.classList.contains('shaka-tooltips-on')) {
1219+
controlsButtonPanel.classList.add('shaka-tooltips-low-position');
1220+
}
12161221
}
12171222
}
12181223

@@ -1941,10 +1946,18 @@ shaka.ui.Controls = class extends shaka.util.FakeEventTarget {
19411946
for (const menu of this.menus_) {
19421947
menu.classList.remove('shaka-low-position');
19431948
}
1949+
const controlsButtonPanel = this.controlsButtonPanel_;
1950+
if (controlsButtonPanel.classList.contains('shaka-tooltips-on')) {
1951+
controlsButtonPanel.classList.remove('shaka-tooltips-low-position');
1952+
}
19441953
} else {
19451954
for (const menu of this.menus_) {
19461955
menu.classList.add('shaka-low-position');
19471956
}
1957+
const controlsButtonPanel = this.controlsButtonPanel_;
1958+
if (controlsButtonPanel.classList.contains('shaka-tooltips-on')) {
1959+
controlsButtonPanel.classList.add('shaka-tooltips-low-position');
1960+
}
19481961
}
19491962
}
19501963

ui/less/overflow_menu.less

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,9 @@
8686
}
8787
}
8888

89-
/* If the seekbar is missing, this is positioned lower.
90-
* TODO: Solve with flex layout instead? */
89+
// If the seekbar is missing, this is positioned lower.
9190
&.shaka-low-position {
92-
/* TODO(b/116651454): eliminate hard-coded offsets */
93-
bottom: 15px;
91+
bottom: @material-icons-width;
9492
}
9593
}
9694

ui/less/tooltip.less

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@
3939
.shaka-tooltips-on {
4040
overflow: visible;
4141

42-
& > [class*="shaka-tooltip"] {
42+
& > .shaka-tooltip {
4343
position: relative;
4444

4545
/* The :after pseudo-element contains the tooltip */
46-
&:hover:after, &:focus-visible:after, &:active:after {
46+
&:hover:after,
47+
&:focus-visible:after,
48+
&:active:after {
4749
content: attr(aria-label);
4850

4951
/* Override .material-icons-round text styling */
@@ -70,6 +72,17 @@
7072
}
7173
}
7274

75+
// If the seekbar is missing, this is positioned lower.
76+
&.shaka-tooltips-low-position {
77+
& > .shaka-tooltip {
78+
&:hover:after,
79+
&:focus-visible:after,
80+
&:active:after {
81+
bottom: @material-icons-width;
82+
}
83+
}
84+
}
85+
7386
/* Adds an additional attribute for the status in .shaka-tooltip-status */
7487
& > .shaka-tooltip-status {
7588
&:hover:after, &:focus-visible:after, &:active:after {

0 commit comments

Comments
 (0)