From 023400c3ccd58cc0842b77af7724744100364962 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Thu, 30 Jan 2020 10:40:49 +0100 Subject: [PATCH] Revert "Fix keyboard shortcut (#587)" (#617) This reverts commit cc3d71f13c0604406eda838344d99866dd94df39. --- src/components/ToolButton.tsx | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/components/ToolButton.tsx b/src/components/ToolButton.tsx index 14f4b972..6e401a02 100644 --- a/src/components/ToolButton.tsx +++ b/src/components/ToolButton.tsx @@ -1,6 +1,6 @@ import "./ToolIcon.scss"; -import React, { useEffect } from "react"; +import React from "react"; type ToolIconSize = "s" | "m"; @@ -30,25 +30,10 @@ export const ToolButton = React.forwardRef(function( props: ToolButtonProps, ref, ) { - const innerRef = React.useRef( - null, - ); + const innerRef = React.useRef(null); React.useImperativeHandle(ref, () => innerRef.current); const sizeCn = `ToolIcon_size_${props.size || DEFAULT_SIZE}`; - const prevChecked = React.useRef( - "checked" in props && props.checked, - ); - - useEffect(() => { - if (props.type !== "button") { - if (props.checked && !prevChecked.current && innerRef.current) { - innerRef.current.focus(); - } - prevChecked.current = props.checked; - } - }); - if (props.type === "button") return (