vuetifyjs / vuetify

🐉 Vue Component Framework
https://vuetifyjs.com
MIT License
39.77k stars 6.95k forks source link

[Feature Request] Clear default value on VNumberInput focus #19900

Open J-Sek opened 4 months ago

J-Sek commented 4 months ago

Problem to solve

User needs to remove 0 when the input is focused and it's initial value is 0. We can achieve better UX by hiding 0 immediately and restoring on blur if necessary.

Proposed solution

Clear internal value on @focus

Example playground (ideally it would emit values on change instead of blur, but I just wanted to showcase the UX)

KaelWD commented 1 month ago

Why not just select? Then it doesn't matter what the initial value is.

https://play.vuetifyjs.com/#eNplVNGu2jAM/RWrmwRIlHK3aQ8M0KZJ+wLEy7qHkBrobppEiVtAiH+fk5ZSWCu1iY997Pi4/X1NvJNZUyOV+8vsr08WSVlZ4wiuIB0Kwm2LwQ32zlQw6nxHuc41nqOrNNoTdACsngPH11wD0BErXEBcAxS4F7WiTWscqfJwpNG0xaKn710BIjrYA+dTxg1dwrUT8v3gTK0LZvzwhuG+c4br1q/vq/bdPruKHqTbDZ7pV4mK6fo8jXCl0FzMyNSkSo3FI0OB2pd0YUyaygrZHyjUq8kZte2jPXGxj+BHIbdJrpNp1OSHtTNuKQuyJKys4o6ug9uySYW1cRk3gVxwKa4ztUbhCpBKeL/Kk+qcipoMWJF+heqSfskT8HRRGDBxTk9lQccFvH2az+05T3oeZirK5kGzSz/DnrOlJwySpDujCnb/qVA4MJoxWftlxjFDiiZ15jQwdEWroGKg5WqeUMZ9JZRaS1XKd+C66WIRdF3t0C2zFnsJaFJitdJ9kOsZ6nXhTJ0uefLq0qSVKVDNyJVVOGjY/O/1PZ6P8Y/YoKaZrJ3j90a4A9LMo0JJ48lrXPZaq3W4jhl4rq4QV3C7LbNgf+pSFts0bCVbhr2MHiz0fRZiwHAYgqWdlWU2mCHeeulKS+CRagtK6AMfi3ynRP8DcLgffvajbyE2jjN/7m3lq+A0nk8YYm0iK3Mkt6mulYqPP/8Al9lXyw==

J-Sek commented 1 month ago

It could even be conditional @focus="model === 0 && $event.currentTarget.select()"... but I am not not sure if I like it. It might be a matter of taste, but I prefer that clear-zero resembles placeholder behavior while focus drags unnecessary attention and might feel unexpected.

That said, I have no more arguments. And if it feels "too niche" for you, I won't feel strongly about closing this feature request without merge.