[number input] Mobile focus mode
Steps to reproduce 🕹
Link to live example:
Steps:
- Open https://mui.com/base-ui/react-number-input/#minimum-and-maximum on mobile
- Press on one of the buttons
https://github.com/mui/material-ui/assets/3165635/f8526d2e-6878-4886-8fa3-e0abd7b0c80a
Current behavior 😯
See how the input is focused
Expected behavior 🤔
It's not clear to me that we should focus the input. On mobile, it's quite annoying to see the virtual keyboard show when using the button is enough to set the expected value.
It doesn't seem that I'm the only one to be annoyed:
- Example with https://www.figma.com/purchase-organization/details
https://github.com/mui/material-ui/assets/3165635/40ef01ff-8383-43ac-875f-7083a3ef68ac
- On https://react-spectrum.adobe.com/react-aria/NumberField.html the input is not focused on mobile
Your environment 🌎
npx @mui/envinfo
Don't forget to mention which browser you used.
Output from `npx @mui/envinfo` goes here.
can you please assign this to me?
assign it to me
This same behaviour occurs in all places where NumberInput(Unstable_NumberInput) is being used as a Mui-focused class name is appending in MuiNumberInput-root on button press too and not only on input press.
@mj12albert
I hope this message finds you well. I was wondering if you're currently working on this particular issue. If not, I would greatly appreciate it if you could consider assigning it to me.
Could you pls assign it to me?
Meanwhile you can use the hook https://mui.com/base-ui/react-number-input/#hook and override the onMouseDown event on the increment/decrement button. Then it won't focus anymore, this is because in the code it says
const handleStepperButtonMouseDown = event => {
event.preventDefault();
if (inputRef.current) {
inputRef.current.focus();
}
};