ant-design / ant-design

An enterprise-class UI design language and React UI library
https://ant.design
MIT License
90.41k stars 46.39k forks source link

InputNumber's changeOnWheel props ignored when type is number #48695

Closed devops3199 closed 2 weeks ago

devops3199 commented 2 weeks ago

Reproduction link

https://ant.design/components/input-number#input-number-demo-change-on-wheel

Steps to reproduce

try the code below.

<InputNumber type="number" min={1} max={10} defaultValue={3} onChange={onChange} changeOnWheel={false} />

What is expected?

A wheel action should be ignored when type is number and changeOnWheel is false.

What is actually happening?

A wheel action is still applied when type is number.

Environment Info
antd 5.16.5
React 17.0.2
System M1
Browser Chrome 120.0.6099.109
wanpan11 commented 2 weeks ago

The InputNumber component is working properly, which should be an issue with the editor on the official website 🧐

devops3199 commented 2 weeks ago

I'm afraid that the issue has arisen in my local.

wanpan11 commented 2 weeks ago

https://stackblitz.com/edit/react-zbmzv8-ikvn43?file=demo.tsx

Can you provide your example

devops3199 commented 2 weeks ago

https://stackblitz.com/edit/react-zbmzv8-pxass1?file=demo.tsx

I added type attribute.

wanpan11 commented 2 weeks ago

The problem is caused by type="number", removing the type is normal. I will explain this issue in the document later 🧐

devops3199 commented 2 weeks ago

https://stackblitz.com/edit/react-zbmzv8-4pcc6d?file=demo.tsx

Even just <Input type="number" /> does not work with changeOnWheel props. As a vanilla html input tag does not allow wheel actions, it's better to take this as a bug.

wanpan11 commented 1 week ago

Vanilla input adds type="number" mouse wheel events are supported by default in Chrome