Issue #1024Opened April 10, 2018by tommedema0 reactions

[Question] real responsive device mode

Question

You might think that changing an iframe's width to a device width acts the same way as a device emulator would, but in reality it does not.

Here is a case in point: if you load pages.github.io in an iframe with a width of 320px, you'll get:

<img width="359" alt="screen shot 2018-04-09 at 4 44 24 pm" src="https://user-images.githubusercontent.com/331833/38528599-4c6ef62c-3c15-11e8-97e6-6c2bf2448da5.png">

You can try it out yourself:

<!doctype html>
<html>
    <body>
        <iframe src="https://pages.github.com/" width="320" height="568" allowfullscreen></iframe>
    </body>
</html>

If you go to pages.github.io and enable chrome's devtools to emulate a device with the same width (320px), it will look much more responsive:

<img width="385" alt="screen shot 2018-04-09 at 4 45 16 pm" src="https://user-images.githubusercontent.com/331833/38528633-6743c5cc-3c15-11e8-97ff-24afbf514a7f.png">

What's happening here is that the browser actually respects the forced width of the page (980px forced; there are no media queries in this page), and scales the content to fit. I believe it may also do some further text zooming:

<img width="398" alt="screen shot 2018-04-09 at 4 47 04 pm" src="https://user-images.githubusercontent.com/331833/38528724-a9994bf4-3c15-11e8-8737-e08dcd46f9c8.png">

Here you can see that while the device width is 320px, the component width is still 980px. Since the whole component is visible, there must be somekind of viewport scaling going on.

For Grapes to really be a "next generation" WYSIWYG editor, full responsiveness mode seems like a must.

Does anyone have any ideas on how we can achieve the same effect as the devtools emulator? Perhaps by using Javascript to dynamically change the viewport scaling? Or by using CSS transforms in a smart way?

Answers (3)

nojackoApril 13, 20180 reactions

Build your CSS to with min-width rather than min-device-width etc... and it's all good.

tommedemaApril 13, 20180 reactions

@nojacko that assumes that I have control over the CSS. That's not the case ;)

Also, the above example does not use min-device-width. It simply uses width: 900px. Small devices are smart enough to scale accordingly. A real responsive mode would therefore do the same.

artfApril 14, 20180 reactions

Thanks for the suggestion @tommedema but currently I don't see any value in start working on such improvement, the current implementation works if you want to build a responsive template and this is what really matters. BTW if you really want to work on this PRs are welcome :)

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.