[whatwg] Comments on <dialog>

Brian Blakely anewpage.media at gmail.com
Wed Dec 18 16:58:48 PST 2013


On Wed, Dec 18, 2013 at 2:13 PM, Ian Hickson <ian at hixie.ch> wrote:

> On Wed, 18 Dec 2013, Brian Blakely wrote:
> > On Tue, Dec 17, 2013 at 3:14 PM, Ian Hickson <ian at hixie.ch> wrote:
> > >
> > > I've added a rule to the spec that says that viewports have to be
> > > pannable so you can see all of a dialog, but I don't know how feasible
> > > that really is.
> >
> > I could see implementations using shadow <div>s to satisfy this It might
> > be beneficial to even codify kind of element as ::modal, representing a
> > modal layer acting as an ancestor for both the ::backdrop and <dialog>.
>
> Not really sure how this would work. Can you elaborate?
>

This is what the shadow DOM would look like for modal dialogs:

::modal
-  ::backdrop
-  <dialog>

::modal is <dialog>'s ancestor, and is available when showModal is called.
 This allows authors to set CSS overflow to whichever value suits their
use-case, and for user agents to establish overflow: auto as the default,
making the dialog inherently pannable when it exceeds the viewport.


> > > > > > 3. When the modal dialog's height changes, either due to CSS or
> > > > > > content changes, the vertical position of the dialog should
> > > > > > change (unless the height exceeds the viewport height).
> > > > >
> > > > > That's an interesting idea, but I'm not convinced it's the right
> > > > > answer. Having the dialog move up and down when stuff is added at
> > > > > the bottom would be quite weird. You can always implement this
> > > > > manually from script.
> > > >
> > > > To go back to hacky and rather difficult-to-maintain JS techniques
> > > > for something so simple seems antithetical to the intention of
> > > > <dialog> to me. Modern modal implementations don't require that.
> > >
> > > My point isn't that we shouldn't offer the feature because it is
> > > already possible. My point is that this feature is actively bad. I'm
> > > saying I don't think it's good UI for the dialog position to change
> > > when it increases in height.
> >
> > It looks like Blink's implementation will recenter the modal when
> > show/showModal are called.
>
> That's per spec, yes. The suggestion above was regarding when the dialog
> changes size while it's already visible, I believe.


You're correct. I was pointing out that there is already a means of
recentering, albeit indirectly.  I could see this being abused by "clever"
hackers, with dialog.close() and dialog.showModal() being called in rapid
succession, simply for the purpose of recentering.



More information about the whatwg mailing list