UEA-PRODEM

This commit is contained in:
2026-06-10 12:14:46 -03:00
parent f54126b9d8
commit 9947565694
5319 changed files with 148520 additions and 129332 deletions
+15 -5
View File
@@ -3,21 +3,31 @@
// src/focus-guards.tsx
import * as React from "react";
var count = 0;
var guards = null;
function FocusGuards(props) {
useFocusGuards();
return props.children;
}
function useFocusGuards() {
React.useEffect(() => {
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
if (!guards) {
guards = { start: createFocusGuard(), end: createFocusGuard() };
}
const { start, end } = guards;
if (document.body.firstElementChild !== start) {
document.body.insertAdjacentElement("afterbegin", start);
}
if (document.body.lastElementChild !== end) {
document.body.insertAdjacentElement("beforeend", end);
}
count++;
return () => {
if (count === 1) {
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
guards?.start.remove();
guards?.end.remove();
guards = null;
}
count--;
count = Math.max(0, count - 1);
};
}, []);
}