3 ms·
I'm not against weird hacks where necessary, but how is this better than the GP's non-hacky suggestion? Inputmode isn't supported by most desktop browsers but
by Wowfunhappy 7y ago
I'm not against weird hacks where necessary, but how is this better than the GP's non-hacky suggestion?
Inputmode isn't supported by most desktop browsers but it doesn't need to be. Every mobile browser save mobile Firefox supports it.
...I wonder what's up with Mobile Firefox?
- brlewis 7y agoUsing the same markup for desktop and mobile means less code which usually translates to fewer bugs.
- Wowfunhappy 7y agoIt would be the same markup. It just wouldn't do anything on desktop. Which is fine because desktops generally have physical keyboards. I apologize if you already know this, but to make sure we're on the same page: what "inputmode" does is tell phones to display the onscreen keyboard as a numpad, instead of a full set of QWERTY letters and numbers. Outside of a few edge-cases, you don't generally need that on desktop.
- brlewis 7y agoTBH I went on autopilot looking at MDN's browser compatibility list. Also as a user of Firefox on Android I was interested in something that works there, but type="tel" doesn't behave any better. The only advantage to not using inputmode is getting rid of an HTML validator warning, so you're right.