Skip to content

Commit 9d099bf

Browse files
OsaSoftclaude
andcommitted
Fix Firefox layout bug with compact mark-watched button (#244)
Firefox handles position:relative on flex items differently from Chrome, causing metadata to shrink on short titles and the button to float away. Wrap the menu button contents in an inner div that holds position:relative instead of applying it directly to the flex item. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3caed6b commit 9d099bf

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

subs.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ ytd-grid-video-renderer.style-scope.ytd-grid-renderer:hover .subs-btn-mark-watch
9898
}
9999

100100
/* Compact layout: positioned below the triple dots menu */
101-
.yt-lockup-metadata-view-model__menu-button {
101+
.subs-btn-compact-wrapper {
102102
position: relative;
103103
}
104104

videos/SubscriptionsVideo.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,18 @@ class SubscriptionVideo extends Video {
5656
? verticalDiv.querySelector(".yt-lockup-metadata-view-model__menu-button")
5757
: null;
5858
if (menuButtonDiv) {
59-
// Compact layout: place inside the menu button area (next to triple dots)
59+
// Compact layout: place inside a wrapper to avoid position:relative on flex item (Firefox bug)
6060
container.classList.add("subs-btn-container--compact");
61-
menuButtonDiv.appendChild(container);
61+
let wrapper = menuButtonDiv.querySelector(".subs-btn-compact-wrapper");
62+
if (!wrapper) {
63+
wrapper = document.createElement("div");
64+
wrapper.classList.add("subs-btn-compact-wrapper");
65+
while (menuButtonDiv.firstChild) {
66+
wrapper.appendChild(menuButtonDiv.firstChild);
67+
}
68+
menuButtonDiv.appendChild(wrapper);
69+
}
70+
wrapper.appendChild(container);
6271
} else {
6372
// Default layout: insert after metadata div
6473
let metadataDiv = verticalDiv.querySelector(":scope > .yt-lockup-view-model__metadata");

0 commit comments

Comments
 (0)