fix(player): YouTube's fullscreen button stays clickable on a short player
The click layer over the embed left the bottom 22 % of the stage free. YouTube's new embed keeps its fullscreen button 80-128 px above the iframe's bottom, so on a stage under ~580 px (a small window, a browser zoomed to 150 %) the layer lay over it and a click paused instead. The cutouts now have px floors (56 top, 140 bottom) and are measured against the iframe's own box.
This commit is contained in:
@@ -444,6 +444,33 @@ describe("PlayerModal — the side arrows", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// YouTube's embed keeps its fullscreen button at a fixed 80–128 px above the iframe's bottom, its gear
|
||||
// and volume along the top. A cutout given only as a share of the height lay over that button on a
|
||||
// short player (a small window, a browser zoomed to 150 %): the click paused instead.
|
||||
describe("PlayerModal — the click layer over the video", () => {
|
||||
const layer = () => {
|
||||
vi.spyOn(api, "videoDetail").mockReturnValue(new Promise(() => {}));
|
||||
const A = vid("A", 0);
|
||||
renderModal(
|
||||
<PlayerModal video={A} queue={[A]} startIndex={0} onClose={() => {}} onState={() => {}} />,
|
||||
);
|
||||
return screen.getByTestId("yt-click-layer");
|
||||
};
|
||||
|
||||
it("leaves YouTube's own controls a px floor at the top and the bottom, whatever the height", () => {
|
||||
const el = layer();
|
||||
expect(el.style.top).toBe("max(12%, 56px)");
|
||||
expect(el.style.bottom).toBe("max(22%, 140px)");
|
||||
});
|
||||
|
||||
it("measures those edges against the iframe's box, not the stage under our docked bar", () => {
|
||||
const el = layer();
|
||||
expect(el.parentElement!.classList.contains("player-stage")).toBe(false);
|
||||
expect(el.parentElement!.closest(".player-stage")).toBeTruthy();
|
||||
expect(el.parentElement!.className).toMatch(/(^|\s)(relative|absolute)(\s|$)/);
|
||||
});
|
||||
});
|
||||
|
||||
// At 133% zoom (a 685px window) a full-width card ran 20px past the bottom and cut its channel
|
||||
// row. The card's width is capped from the window height less what sits under the video, measured.
|
||||
describe("PlayerModal — fits the window's height", () => {
|
||||
|
||||
Reference in New Issue
Block a user