Egos at the Door
Today was another perfect example of why having an ego and being a programmer seem completely incompatible. This site is built only really using HTML and CSS - admittedly there is some templating and preprocessing done with Sass/Liquid etc - but it should still be easy enough.
I spent maybe two hours today staring at the mobile styling
for this page. I had a regular desktop browser set to 375px
wide, but everything was too small, and the DOM elements
were telling me that there were bigger than they demonstrably were.
console.log(screen.width);
returned 375px - what we'd
expect. console.log(document.querySelector('body').screenWidth);
however, returned 980px, despite it clearly being visually
less than the width of the device. I even hooked up an old
android phone to my PC and
installed developer options by tapping the build number 7 times. I had no joy whatsoever.
What. The. Fuck.
Except not really what the fuck, because anyone who would so brazenly call themselves a web developer, as I have, would know that the first thing to check would be whether or not a meta value had been set for the viewport. I'm a clown.
At least I am a clown who learned something, and I suspect this is the last time I make this mistake again - at the very least I hope it is the last time I waste nearly 2 hours trying to correct it. The relief when I could finally get media queries working correctly was palpable.