mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-05 20:56:13 -05:00
Try with no MutationObserver
This commit is contained in:
parent
3815cab0eb
commit
e395308d70
44
app/root.tsx
44
app/root.tsx
|
|
@ -329,31 +329,31 @@ export default function App() {
|
|||
|
||||
// Move overflow:hidden from html to body to allow position: sticky and position: fixed
|
||||
// elements to work properly when a React Aria Component disabled scrolling
|
||||
useEffect(() => {
|
||||
const htmlStyle = document.documentElement.style;
|
||||
const bodyStyle = document.body.style;
|
||||
// useEffect(() => {
|
||||
// const htmlStyle = document.documentElement.style;
|
||||
// const bodyStyle = document.body.style;
|
||||
|
||||
const observer = new MutationObserver(() => {
|
||||
if (htmlStyle.overflow === "hidden") {
|
||||
htmlStyle.overflow = "";
|
||||
bodyStyle.overflow = "hidden";
|
||||
bodyStyle.scrollbarGutter = "stable";
|
||||
} else if (
|
||||
htmlStyle.overflow === "" &&
|
||||
htmlStyle.scrollbarGutter !== "stable"
|
||||
) {
|
||||
bodyStyle.overflow = "";
|
||||
bodyStyle.scrollbarGutter = "";
|
||||
}
|
||||
});
|
||||
// const observer = new MutationObserver(() => {
|
||||
// if (htmlStyle.overflow === "hidden") {
|
||||
// htmlStyle.overflow = "";
|
||||
// bodyStyle.overflow = "hidden";
|
||||
// bodyStyle.scrollbarGutter = "stable";
|
||||
// } else if (
|
||||
// htmlStyle.overflow === "" &&
|
||||
// htmlStyle.scrollbarGutter !== "stable"
|
||||
// ) {
|
||||
// bodyStyle.overflow = "";
|
||||
// bodyStyle.scrollbarGutter = "";
|
||||
// }
|
||||
// });
|
||||
|
||||
observer.observe(document.documentElement, {
|
||||
attributes: true,
|
||||
attributeFilter: ["style"],
|
||||
});
|
||||
// observer.observe(document.documentElement, {
|
||||
// attributes: true,
|
||||
// attributeFilter: ["style"],
|
||||
// });
|
||||
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
// return () => observer.disconnect();
|
||||
// }, []);
|
||||
|
||||
return (
|
||||
<ThemeProvider
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user