Last active
January 2, 2024 22:14
-
-
Save pedro-mass/50c31c5bb6e874458791108de13ad5ab to your computer and use it in GitHub Desktop.
Revisions
-
pedro-mass revised this gist
Jan 2, 2024 . 1 changed file with 10 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,10 @@ .visually-hidden { position: absolute; overflow: hidden; clip: rect(0 0 0 0); height: 1px; width: 1px; margin: -1px; padding: 0; border: 0; } -
pedro-mass revised this gist
Jan 2, 2024 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ -
pedro-mass revised this gist
Jan 2, 2024 . 1 changed file with 30 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,30 @@ // Replace “.the-fixed-child” for a CSS selector // that matches the fixed-position element: const selector = ".fixed"; function findCulprits(elem) { if (!elem) { throw new Error(`Could not find element with selector: "${selector}"`); } let parent = elem.parentElement; while (parent) { const { transform, willChange, filter } = getComputedStyle(parent); if ( transform !== "none" || willChange === "transform" || filter !== "none" ) { console.warn("🚨 Found a culprit! 🚨\n", parent, { transform, willChange, filter, }); } parent = parent.parentElement; } } findCulprits(document.querySelector(selector)); -
pedro-mass revised this gist
Jan 2, 2024 . 1 changed file with 25 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1 +1,25 @@ // ref: https://courses.joshwcomeau.com/css-for-js/02-rendering-logic-2/17-troubleshooting // Replace “.the-sticky-child” for a CSS selector // that matches the sticky-position element: const selector = ".the-sticky-child"; function findCulprits(elem) { if (!elem) { throw new Error("Could not find element with that selector"); } let parent = elem.parentElement; while (parent) { const { overflow } = getComputedStyle(parent); if (["auto", "scroll", "hidden"].includes(overflow)) { console.log(overflow, parent); } parent = parent.parentElement; } } findCulprits(document.querySelector(selector)); -
pedro-mass created this gist
Jan 2, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@