From b245655c411ae0c12d292aa0b302bedb7737c686 Mon Sep 17 00:00:00 2001 From: Egor Savkin Date: Fri, 8 Sep 2023 15:39:38 +0800 Subject: [PATCH] Fix tooltip showed out when options overlay was closed Signed-off-by: esavkin --- static/js/shop_components.jsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/static/js/shop_components.jsx b/static/js/shop_components.jsx index 95c6fc3..3af8e87 100644 --- a/static/js/shop_components.jsx +++ b/static/js/shop_components.jsx @@ -15,7 +15,7 @@ class Radio extends Component { super(props); // Initialize the state object with the initial values from the props this.state = { - variant: props.outvar in props.data ? props.data[props.outvar] : props.variants[ props.fallback ? props.fallback : 0 ], + variant: props.outvar in props.data ? props.data[props.outvar] : props.variants[props.fallback ? props.fallback : 0], }; // Bind the event handler to this @@ -79,7 +79,8 @@ class Radio extends Component { } function RadioWrapper(target, id, data, {title, variants, outvar, fallback, icon, tip}) { - return ; } @@ -336,7 +337,11 @@ export function ProcessOptions({options, data, target, id}) { export function OptionsDialogPopup({options, data, target, id, big}) { const [show, setShow] = useState(false); - const ref = useClickAway(() => setShow(false)); + const ref = useClickAway((e) => { + if (e.type === "mousedown") // ignore touchstart + setShow(false) + } + ); let div_classes = "overlayVariant border rounded " + (big ? "overlay-bigcard" : "overlay-smallcard") const handleClick = (event) => {