fix: make auth dropdown controlled in React to prevent password manager focus-loss from closing it
All checks were successful
Build & Push Docker Image to Gitea Registry / build-and-push (push) Successful in 2m41s

This commit is contained in:
Kroonk
2026-05-21 11:35:21 +02:00
parent a21e2df6c4
commit 85f50c5530
2 changed files with 42 additions and 13 deletions

View File

@@ -10,7 +10,7 @@ import Guest from "./Guest";
import Login from "./Login";
import Register from "./Register";
export default function AuthDropdownContent() {
export default function AuthDropdownContent({ onClose }: { onClose?: () => void }) {
const session = useContext(SessionContext);
const [activeTab, setActiveTab] = useState<"guest" | "login" | "register">("guest");
const [serverMessage, setServerMessage] = useState<string | null>(null);
@@ -29,6 +29,9 @@ export default function AuthDropdownContent() {
}, []);
function closeDropdown() {
if (onClose) {
onClose();
}
if (typeof document !== "undefined" && document.activeElement) {
(document.activeElement as HTMLElement).blur();
}