This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24991 - Modal <dialog>s should fill the screen on mobile devices
Summary: Modal <dialog>s should fill the screen on mobile devices
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-10 18:22 UTC by Ian 'Hixie' Hickson
Modified: 2014-09-05 20:47 UTC (History)
10 users (show)

See Also:


Attachments

Description Ian 'Hixie' Hickson 2014-03-10 18:22:26 UTC
It would be good if <dialog> elements shown with showModal() filled the screen on handheld devices with small screens, at least if the viewport is at 1:1 scale (as opposed to when the browser is pretending to have a desktop size).

One option would be:

   @media all and (max-width: AAA) {
     BBB { top: 0; right: 0; bottom: 0; left: 0; width: auto; height: auto; }
   }

...where "AAA" is some width that phones all match but tablets and desktops don't, and "BBB" is some magical selector to match modal dialogs.

Anyone got any other ideas?

If the above seems sound, what should AAA and BBB be?
Comment 1 Tab Atkins Jr. 2014-03-10 20:01:07 UTC
The 'max-width' MQ bases itself on the window's width, not the screen's width, so it doesn't reliably detect *any* device.

The 'max-device-width' MQ bases itself on the device's width, but devices occupy a wide and overlapping set of widths, plus if it makes sense for a narrow phone to get fullscreen dialogs, it probably makes sense for a narrow desktop window to do the same.

What is the actual feature you're trying to discriminate against?
Comment 2 Ian 'Hixie' Hickson 2014-04-01 16:45:18 UTC
Well presumably it doesn't matter if you're on a small device or just a narrow window on a big device, the desired look is the same.
Comment 3 Ian 'Hixie' Hickson 2014-05-06 22:31:46 UTC
Tab suggests on IRC that BBB should be "dialog:modal", so:

   http://lists.w3.org/Archives/Public/www-style/2014May/0022.html
Comment 4 Ian 'Hixie' Hickson 2014-07-21 22:05:29 UTC
Ok, :modal is to be added to Selectors:
   http://lists.w3.org/Archives/Public/www-style/2014May/0056.html

I'll add the detailed definition in HTML at #selector-modal.

It seems, based on reading sites about responsive design, that we should probably put the cut-off at 540px (inclusive), so it will be:

   @media all and (max-width: 540px) {
     dialog:modal { top: 0; right: 0; bottom: 0; left: 0; width: auto; height: auto; }
   }

That seem ok to everyone?
Comment 5 Travis Leithead [MSFT] 2014-07-28 19:18:14 UTC
(In reply to Ian 'Hixie' Hickson from comment #4)
> Ok, :modal is to be added to Selectors:
>    http://lists.w3.org/Archives/Public/www-style/2014May/0056.html
> 
> I'll add the detailed definition in HTML at #selector-modal.
> 
> It seems, based on reading sites about responsive design, that we should
> probably put the cut-off at 540px (inclusive), so it will be:
> 
>    @media all and (max-width: 540px) {
>      dialog:modal { top: 0; right: 0; bottom: 0; left: 0; width: auto;
> height: auto; }
>    }
> 
> That seem ok to everyone?

It still seems very weird to make a modal dialog full screen at some certain width--how can you be sure this is the right stylistic design for most modal dialogs?

For example, my phone's meeting notification modal dialog is as wide as the screen, but not as tall--this gives me the "depth" clue that this is a modal dialog--otherwise, it might have looked like a navigation. If you must specify this default styling (which I'm not 100% sold on), then perhaps setting the default size to just inside of the device's display bounds would be better?
Comment 6 Ian 'Hixie' Hickson 2014-07-28 21:20:52 UTC
We could definitely have a margin on it, yeah. Also maybe making the height be auto, and pinning the dialog to the top?

This is just the default styling. The idea is to avoid having modal dialogs by default just go off the side of the screen. I doubt most people will stick to this styling.
Comment 7 Travis Leithead [MSFT] 2014-07-28 21:28:12 UTC
(In reply to Ian 'Hixie' Hickson from comment #6)
> We could definitely have a margin on it, yeah. Also maybe making the height
> be auto, and pinning the dialog to the top?
> 
> This is just the default styling. The idea is to avoid having modal dialogs
> by default just go off the side of the screen. I doubt most people will
> stick to this styling.

I'm no UX designer, but having auto-height (top-aligned) and a small margin sounds good for the default.
Comment 8 contributor 2014-09-05 20:47:55 UTC
Checked in as WHATWG revision r8750.
Check-in comment: Make the default styling for modal dialogs not overflow the device on small screens
http://html5.org/tools/web-apps-tracker?from=8749&to=8750