I am a little baffled by an apparent error in the horizontal scaling of widgets in both Chrome and Firefox on my phone, in the App on my Android phone and on a larger screen on an iPad Pro but which doesn’t occur in a desktop browser in any of Chrome, Firefox or Edge.
Consider the following simple widget consisting of two 24px square buttons.
a) the buttons should be square and b) arranged as they are, the second button should be immediately to the right of and immediately below the first button and on the desktop that is exactly what I get.
On the tablet / phone devices I get this
The vertical spacing is right but the button has been stretched horizontally so when the bottom button is indented by 24px the top button overlaps it.
These are very simple buttons. I can’t see what is causing this issue and it’s really messing up my UI. Any help would be very gratefully received.
It looks fine emulating a phone with a 760x360 viewport or an iPad Pro which is 1366x1024. I’ve tried it using both Chrome and Firefox, in the latter case specifically emulating my Galaxy S10. Everything looks as it should.
Needless to say, just shrinking the PC browser window to reduce the viewport to mobile sizes doesn’t cause the problem either.
This is odd. On any browser on a desktop it’s fine including on small viewports and emulating mobile devices. But on any mobile device, either Android or Apple, including one with a large viewport, and also in the Android Openhab app, there’s that same stretching problem.
That’s a shame, my feeling is that pretty much means the problem has something to do with the extra css that f7 is adding to the mobile display. Debugging mobile browser pages is a bit of a pain (I’m fighting with a similar problem in a completely different project right now as well), as you usually need to connect the mobile device via the appropriate debugging procotol/package to the desktop.
A couple of other things I might try to further localize the issue:
What if you change the f7-card at the root of the widget to a plain old div?
Same for the buttons?
What if you set border-sizing to content-box for both buttons?
What if you set left and right padding to 0 for both buttons?
Great suggestions Justin (some of which I’ll have to look up becasue my HTML and CSS knowledge is not that great). The fact that it’s the same across Android and Apple and for both Firefox and Chrome suggests to me at least that the issue lies with f7.
I’ll play with it over the weekend and report back.