Skip to content

Commit

Permalink
fix(input): fix input stopPropagation of React16 (#2833)
Browse files Browse the repository at this point in the history
  • Loading branch information
HaixingOoO authored Apr 4, 2024
1 parent 6a629e3 commit e306ac9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ const Input = forwardRefWithStatics(
// https://github.com/Tencent/tdesign-react/issues/2320
function handleMouseDown(e: React.MouseEvent<SVGSVGElement, globalThis.MouseEvent>) {
e.stopPropagation();
// 兼容React16
e.nativeEvent.stopImmediatePropagation();
}
function handleClear(e: React.MouseEvent<SVGSVGElement>) {
onChange?.('', { e, trigger: 'clear' });
Expand Down
2 changes: 2 additions & 0 deletions src/range-input/RangeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ const RangeInput = React.forwardRef<RangeInputInstanceFunctions, RangeInputProps
// https://github.com/Tencent/tdesign-react/issues/2320
function handleMouseDown(e: React.MouseEvent<SVGSVGElement, globalThis.MouseEvent>) {
e.stopPropagation();
// 兼容React16
e.nativeEvent.stopImmediatePropagation();
}

function handleClear(e: React.MouseEvent<SVGSVGElement>) {
Expand Down

0 comments on commit e306ac9

Please sign in to comment.