Skip to content

Commit 029f191

Browse files
committed
refactor(Input): remove mouse down event
1 parent 77f1b58 commit 029f191

File tree

3 files changed

+1
-18
lines changed

3 files changed

+1
-18
lines changed

packages/components/input/Input.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ const Input = forwardRefWithStatics(
139139
suffixIconNew = (
140140
<CloseCircleFilledIcon
141141
className={`${classPrefix}-input__suffix-clear`}
142-
onMouseDown={handleMouseDown}
143142
onClick={handleClear}
144143
/>
145144
);
@@ -316,13 +315,6 @@ const Input = forwardRefWithStatics(
316315
onChange(newStr, { e, trigger });
317316
}
318317
}
319-
// 添加MouseDown阻止冒泡,防止點擊Clear value會導致彈窗閃爍一下
320-
// https://github.com/Tencent/tdesign-react/issues/2320
321-
function handleMouseDown(e: React.MouseEvent<SVGSVGElement, globalThis.MouseEvent>) {
322-
e.stopPropagation();
323-
// 兼容React16
324-
e.nativeEvent.stopImmediatePropagation();
325-
}
326318
function handleClear(e: React.MouseEvent<SVGSVGElement>) {
327319
onChange?.('', { e, trigger: 'clear' });
328320
onClear?.({ e });

packages/components/popup/Popup.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ const Popup = forwardRef<PopupRef, PopupProps>((originalProps, ref) => {
226226
)}
227227
style={getOverlayStyle(overlayInnerStyle)}
228228
onScroll={handleScroll}
229-
// {...getPopupProps()}
230229
>
231230
{content}
232231
{showArrow && (

packages/components/range-input/RangeInput.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const RangeInput = React.forwardRef<RangeInputInstanceFunctions, RangeInputProps
9292

9393
if (isShowClearIcon) {
9494
suffixIconNew = (
95-
<CloseCircleFilledIcon className={`${name}__suffix-clear`} onMouseDown={handleMouseDown} onClick={handleClear} />
95+
<CloseCircleFilledIcon className={`${name}__suffix-clear`} onClick={handleClear} />
9696
);
9797
}
9898

@@ -101,14 +101,6 @@ const RangeInput = React.forwardRef<RangeInputInstanceFunctions, RangeInputProps
101101
const suffixContent = isFunction(suffix) ? suffix() : suffix;
102102
const suffixIconContent = renderIcon(classPrefix, 'suffix', parseTNode(suffixIconNew));
103103

104-
// 添加MouseDown阻止冒泡,防止點擊Clear value會導致彈窗閃爍一下
105-
// https://github.com/Tencent/tdesign-react/issues/2320
106-
function handleMouseDown(e: React.MouseEvent<SVGSVGElement, globalThis.MouseEvent>) {
107-
e.stopPropagation();
108-
// 兼容React16
109-
e.nativeEvent.stopImmediatePropagation();
110-
}
111-
112104
function handleClear(e: React.MouseEvent<SVGSVGElement>) {
113105
onClear?.({ e });
114106
onChange?.(['', ''], { e, trigger: 'clear', position: 'all' });

0 commit comments

Comments
 (0)