r/badcode • • Mar 01 '22

js FE developer checks for mobile for responsivity

Post image
484 Upvotes

43 comments sorted by

View all comments

21

u/[deleted] Mar 01 '22

[removed] — view removed comment

16

u/kristallnachte Mar 01 '22

Even better is "why the heck does it matter if they're on a phone or not?"

That's just not something useful.

What is useful is things like viewport size and input device.

1

u/jmona789 Mar 02 '22

Could be for a nav where sub items show on hover. Since hover doesn't make sense on a touch screen device

1

u/kristallnachte Mar 02 '22

That's still an input issue, not a device issue.

Hover works on phones when I use a mouse.

1

u/jmona789 Mar 02 '22

Well sure it works when you use a mouse but your users aren't going to be using a mouse on their phone.

1

u/kristallnachte Mar 02 '22

Maybe.

They may not use touch either.

Blind people use interactions more akin to keyboard inputs than they do touch inputs on the site.

But even in the "dumb" sense of this, viewport is a perfect fine and simply way to handle it.

1

u/RobDoingStuff Mar 03 '22

But wouldn't a simple media query for screen size accurately accommodate like 99% of devices, anyway? Phones and tablets usually have significantly smaller resolutions than PCs.