mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-09 22:14:29 +09:00
fix: Fix reset on gap icons (#4908)
Closes https://github.com/webstudio-is/webstudio/issues/4861 ## Description 1. reset with option/alt + click on icon without waiting for a tooltip to click reset button 2. can't click on icon to open the tooltip ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
This commit is contained in:
1 parent
62a6d939d8
commit
a8146c5493
2 files changed
+12
-7
No files matched your search
@@ -94,12 +94,13 @@ const GapTooltip = ({
|
||||
// prevent closing tooltip on content click
|
||||
onPointerDown={(event) => event.preventDefault()}
|
||||
triggerProps={{
|
||||
onClick: (event) => {
|
||||
onClick(event) {
|
||||
if (event.altKey) {
|
||||
event.preventDefault();
|
||||
onReset();
|
||||
return;
|
||||
}
|
||||
setIsOpen(true);
|
||||
},
|
||||
}}
|
||||
content={
|
||||
|
||||
+10
-6
@@ -35,6 +35,7 @@ import {
|
||||
useState,
|
||||
useMemo,
|
||||
type ComponentProps,
|
||||
type RefObject,
|
||||
} from "react";
|
||||
import { useUnitSelect, type UnitOption } from "./unit-select";
|
||||
import { parseIntermediateOrInvalidValue } from "./parse-intermediate-or-invalid-value";
|
||||
@@ -99,11 +100,11 @@ const useScrub = ({
|
||||
onAbort: () => void;
|
||||
shouldHandleEvent?: (node: Node) => boolean;
|
||||
}): [
|
||||
React.RefObject<HTMLDivElement | null>,
|
||||
React.RefObject<HTMLInputElement | null>,
|
||||
RefObject<HTMLInputElement | null>,
|
||||
RefObject<HTMLInputElement | null>,
|
||||
] => {
|
||||
const scrubRef = useRef<HTMLDivElement | null>(null);
|
||||
const inputRef = useRef<HTMLInputElement | null>(null);
|
||||
const scrubRef = useRef<HTMLInputElement>(null);
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const onChangeRef = useRef(onChange);
|
||||
const onChangeCompleteRef = useRef(onChangeComplete);
|
||||
@@ -991,8 +992,11 @@ export const CssValueInput = ({
|
||||
autoFocus={autoFocus}
|
||||
onBlur={handleOnBlur}
|
||||
onKeyDown={inputPropsHandleKeyDown}
|
||||
containerRef={disabled ? undefined : scrubRef}
|
||||
inputRef={mergeRefs(inputRef, props.inputRef ?? null)}
|
||||
inputRef={mergeRefs(
|
||||
inputRef,
|
||||
props.inputRef,
|
||||
disabled ? undefined : scrubRef
|
||||
)}
|
||||
name={property}
|
||||
color={value.type === "invalid" ? "error" : undefined}
|
||||
prefix={finalPrefix}
|
||||
|
||||
Reference in new issue
Block a user