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
All checks were successful
Build & Push Docker Image to Gitea Registry / build-and-push (push) Successful in 2m41s
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user