3 ms·
Using the same markup for desktop and mobile means less code which usually translates to fewer bugs.
by brlewis 7y ago
Using 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.