<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>233329</bug_id>
          
          <creation_ts>2021-11-18 12:27:36 -0800</creation_ts>
          <short_desc>Web Inspector: Ability to emulate mobile viewport changes in responsive design mode</short_desc>
          <delta_ts>2021-11-25 12:28:23 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Inspector</component>
          <version>Safari Technology Preview</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Anthony Frehner">afrehner.work</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>inspector-bugzilla-changes</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1816562</commentid>
    <comment_count>0</comment_count>
    <who name="Anthony Frehner">afrehner.work</who>
    <bug_when>2021-11-18 12:27:36 -0800</bug_when>
    <thetext>When working on responsive components or websites, I frequently find myself wishing that my desktop browser could better emulate how a mobile browser **actually** behaves - specifically, when it comes to resizing the viewport as you scroll up and down.

And yes, it&apos;s true that nothing beats using an actual mobile device to test your code, that doesn&apos;t mean that we can&apos;t make the desktop developer experience better.

These following cases are only _some_ of the examples of where the desktop&apos;s &quot;Responsive Design Mode&quot; experience doesn&apos;t actually match how mobile browsers behave:

## CSS Viewport Units

I&apos;ve been working with viewport units, like `vh`, for a long time. I&apos;ve even [helped resolve](https://github.com/w3c/csswg-drafts/issues/4329) some of the issues with them, and it&apos;s exciting to see [Safari Technical Preview release 135](https://developer.apple.com/safari/technology-preview/release-notes/) with support for the new `*vh` units such as `lvh`, `svh`, and `dvh`.

These units can subtly or even quite drastically change how your website looks and behaves - especially the [`dvh` unit](https://dev.to/frehner/css-vh-dvh-lvh-svh-and-vw-units-27k4#dynamic-viewport-units) (which behaves as `vh` used to behave when it was first implemented, until it was determined that in most cases that&apos;s actually [pretty bad behavior](https://github.com/w3c/csswg-drafts/issues/4329#issuecomment-542420036)).

However, if you [play around with the new units](https://codepen.io/afrehner/pen/ZEJVbaE) on your desktop browser (assuming you use a browser that supports them), nothing happens - even if you&apos;re in responsive design mode! 

That&apos;s because your desktop browser doesn&apos;t change the viewport size, while the mobile version of your browser does. So the **only** solution is to have an actual mobile browser open to test your component or website. (Again, ideally you&apos;re doing this already. But it can slow things down if this is your only option to test.)

## Window Resize Events

If you have an event listener for window resize events, you may not have realized that mobile browsers fire those events quite frequently as you scroll around - because your desktop browser doesn&apos;t change the viewport, even in responsive design mode. [Test out this codesandbox](https://xleeg.csb.app/) on your phone and on your desktop to see the difference. (Source code found [here](https://codesandbox.io/s/hopeful-shape-xleeg?file=/index.html))

## Proposal

I think it would be a great improvement if desktop browsers&apos; mobile responsive design mode had the ability to emulate the viewport changing sizes as you scroll. 

Additional thoughts:

* Perhaps it could be turned on and off with a preference toggle?
* You (probably?) don&apos;t need to add the actual browser chrome to the emulator, you could just resize the window. At least for an initial first release
* Maybe it should only work when you have an actual device selected in the Device picker dropdown?

----

Related Chrome request https://bugs.chromium.org/p/chromium/issues/detail?id=1271608
Related Firefox request https://bugzilla.mozilla.org/show_bug.cgi?id=1741940</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1817835</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-11-25 12:28:23 -0800</bug_when>
    <thetext>&lt;rdar://problem/85753996&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>