kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Toggle: prevent clicking label getting it stuck
rodzic
406e6f3f40
commit
1c71cf3da4
|
@ -9,8 +9,7 @@ interface IToggle extends Pick<React.InputHTMLAttributes<HTMLInputElement>, 'id'
|
|||
const Toggle: React.FC<IToggle> = ({ id, size = 'md', name, checked, onChange, required, disabled }) => {
|
||||
const input = useRef<HTMLInputElement>(null);
|
||||
|
||||
const handleClick: React.MouseEventHandler<HTMLButtonElement> = (e) => {
|
||||
e.preventDefault();
|
||||
const handleClick: React.MouseEventHandler<HTMLButtonElement> = () => {
|
||||
input.current?.focus();
|
||||
input.current?.click();
|
||||
};
|
||||
|
|
Ładowanie…
Reference in New Issue