Skip to content

Commit b95de7c

Browse files
wonjangcloud9claude
andcommitted
fix(check): name a color-graded video by its own selector in layout findings
A color-graded <video> is painted into a canvas the runtime inserts after it, with a runtime-generated id (__hf_color_grading_<video id>). Layout findings on that canvas (e.g. container_overflow for a punch-in inside an overflow:hidden box) named the canvas, so the fix hint "mark intentional overflow with data-layout-allow-overflow" pointed at an element the author never wrote. The audit already reads flags from the authored video (authoredElement); uniqueSelectorFor now names that element too, so the finding's selector, data attributes and source file are the video's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 4962330 commit b95de7c

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎packages/cli/src/commands/layout-audit.browser.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@
9191
return `${selectorFor(parent)} > ${element.tagName.toLowerCase()}:nth-of-type(${index})`;
9292
}
9393

94-
function uniqueSelectorFor(element) {
94+
function uniqueSelectorFor(subject) {
95+
const element = authoredElement(subject);
9596
const preferred = selectorFor(element);
9697
try {
9798
if (document.querySelectorAll(preferred).length === 1) return preferred;

‎packages/cli/src/commands/layout-audit.browser.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,7 @@ describe("layout-audit.browser coordinate-frame findings", () => {
14561456
["flags", "", true],
14571457
["clears", "data-layout-allow-overflow", false],
14581458
])(
1459-
"%s a graded video's canvas overflowing a clipping wrapper, per the video's own flag",
1459+
"%s a graded video's canvas overflowing a clipping wrapper by the video's selector and flag",
14601460
(_, flag, flagged) => {
14611461
document.body.innerHTML = `
14621462
<div id="root" data-composition-id="main" data-width="1920" data-height="1080">
@@ -1476,7 +1476,7 @@ describe("layout-audit.browser coordinate-frame findings", () => {
14761476
installAuditScript();
14771477

14781478
const overflow = runAudit().filter((issue) => issue.code === "container_overflow");
1479-
expect(overflow.map((issue) => issue.selector)).toEqual(flagged ? ["#art"] : []);
1479+
expect(overflow.map((issue) => issue.selector)).toEqual(flagged ? ["#clip"] : []);
14801480
},
14811481
);
14821482

0 commit comments

Comments
 (0)