From 1c71cf3da44600ed6302f9d43a60fcef11a42426 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 31 Mar 2023 12:04:13 -0500 Subject: [PATCH] Toggle: prevent clicking label getting it stuck --- app/soapbox/components/ui/toggle/toggle.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/soapbox/components/ui/toggle/toggle.tsx b/app/soapbox/components/ui/toggle/toggle.tsx index a92501984..34651e98d 100644 --- a/app/soapbox/components/ui/toggle/toggle.tsx +++ b/app/soapbox/components/ui/toggle/toggle.tsx @@ -9,8 +9,7 @@ interface IToggle extends Pick, 'id' const Toggle: React.FC = ({ id, size = 'md', name, checked, onChange, required, disabled }) => { const input = useRef(null); - const handleClick: React.MouseEventHandler = (e) => { - e.preventDefault(); + const handleClick: React.MouseEventHandler = () => { input.current?.focus(); input.current?.click(); };