Skip to content

Commit 979af15

Browse files
authored
Change modal <dialog>s to be positioned via CSS
Fixes w3c/csswg-drafts#4645. Fixes #5178.
1 parent 895fd80 commit 979af15

File tree

1 file changed

+21
-46
lines changed

1 file changed

+21
-46
lines changed

source

Lines changed: 21 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3308,6 +3308,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
33083308
<li>The <dfn data-x-href="https://drafts.csswg.org/css2/#flow-control">'clear'</dfn> property</li>
33093309
<li>The <dfn data-x-href="https://drafts.csswg.org/css2/#the-width-property">'width'</dfn> property</li>
33103310
<li>The <dfn data-x-href="https://drafts.csswg.org/css2/#the-height-property">'height'</dfn> property</li>
3311+
<li>The <dfn data-x-href="https://drafts.csswg.org/css2/#min-max-widths">'max-width'</dfn> property</li>
3312+
<li>The <dfn data-x-href="https://drafts.csswg.org/css2/#min-max-heights">'max-height'</dfn> property</li>
33113313
<li>The <dfn data-x-href="https://drafts.csswg.org/css2/#propdef-line-height">'line-height'</dfn> property</li>
33123314
<li>The <dfn data-x-href="https://drafts.csswg.org/css2/#propdef-vertical-align">'vertical-align'</dfn> property</li>
33133315
<li>The <dfn data-x-href="https://drafts.csswg.org/css2/#content%E2%91%A0">'content'</dfn> property</li>
@@ -3366,6 +3368,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
33663368
<li>The <dfn data-x-href="https://drafts.csswg.org/css-logical/#propdef-border-block-start-width">'border-block-start-width'</dfn> property</li>
33673369
<li>The <dfn data-x-href="https://drafts.csswg.org/css-logical/#propdef-block-size">'block-size'</dfn> property</li>
33683370
<li>The <dfn data-x-href="https://drafts.csswg.org/css-logical/#propdef-inline-size">'inline-size'</dfn> property</li>
3371+
<li>The <dfn data-x-href="https://drafts.csswg.org/css-logical/#propdef-inset-block-start">'inset-block-start'</dfn> property</li>
3372+
<li>The <dfn data-x-href="https://drafts.csswg.org/css-logical/#propdef-inset-block-end">'inset-block-end'</dfn> property</li>
33693373
</ul>
33703374

33713375
<p>The following terms and features are defined in <cite>CSS Color</cite>: <ref
@@ -57344,8 +57348,6 @@ interface <dfn>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
5734457348
<li><p>Add an <code data-x="attr-dialog-open">open</code> attribute to the <code>dialog</code>
5734557349
element, whose value is the empty string.</p></li>
5734657350

57347-
<li><p>Set the <code>dialog</code> to the <span>normal alignment</span> mode.</p></li>
57348-
5734957351
<li><p>Run the <span>dialog focusing steps</span> for the <code>dialog</code> element.</p></li>
5735057352
</ol>
5735157353

@@ -57362,9 +57364,10 @@ interface <dfn>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
5736257364
<li><p>If <var>subject</var> is not <span>connected</span>, then throw an
5736357365
<span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.</p></li>
5736457366

57365-
<li><p>Add an <code data-x="attr-dialog-open">open</code> attribute to <var>subject</var>, whose value is the empty string.</p></li>
57367+
<li><p>Add an <code data-x="attr-dialog-open">open</code> attribute to <var>subject</var>, whose
57368+
value is the empty string.</p></li>
5736657369

57367-
<li><p>Set the <code>dialog</code> to the <span>centered alignment</span> mode.</p></li>
57370+
<li><p>Set the <span>is modal</span> flag of <var>subject</var> to true.</p></li>
5736857371

5736957372
<li>
5737057373
<p>Let <var>subject</var>'s <span>node document</span> be <span data-x="blocked by a
@@ -57446,6 +57449,8 @@ interface <dfn>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
5744657449
<li><p>Remove <var>subject</var>'s <code data-x="attr-dialog-open">open</code>
5744757450
attribute.</p></li>
5744857451

57452+
<li><p>Set the <span>is modal</span> flag of <var>subject</var> to false.</p></li>
57453+
5744957454
<li><p>If the argument <var>result</var> was provided, then set the <code
5745057455
data-x="dom-dialog-returnValue">returnValue</code> attribute to the value of <var>result</var>.</p></li>
5745157456

@@ -57482,48 +57487,8 @@ interface <dfn>HTMLDialogElement</dfn> : <span>HTMLElement</span> {
5748257487

5748357488
<hr>
5748457489

57485-
<p>A <code>dialog</code> element is in one of two modes: <dfn>normal alignment</dfn> or
57486-
<dfn>centered alignment</dfn>. When a <code>dialog</code> element is created, it must be placed in
57487-
the <span>normal alignment</span> mode. In this mode, normal CSS requirements apply to the
57488-
element. The <span>centered alignment</span> mode is only used for <code>dialog</code> elements
57489-
that are in the <span>top layer</span>. <ref spec=FULLSCREEN> <ref spec=CSS></p>
57490-
57491-
<p>When an element <var>subject</var> is placed in <span>centered alignment</span> mode, and when
57492-
it is in that mode and has new rendering boxes created, the user agent must set up the element
57493-
such that its static position of the edge that corresponds to <var>subject</var>'s parent's
57494-
<span>block-start</span> edge, for the purposes of calculating the <span>used value</span> of the
57495-
appropriate box offset property (<span>'top'</span>, <span>'right'</span>, <span>'bottom'</span>,
57496-
or <span>'left'</span>), is the value that would place the element's <span>margin edge</span> on
57497-
the side that corresponds to <var>subject</var>'s parent's <span>block-start</span> side as far
57498-
from the same-side edge of the <span>viewport</span> as the element's opposing side <span>margin
57499-
edge</span> from that same-side edge of the <span>viewport</span>, if the element's dimension
57500-
(<span>'width'</span> or <span>'height'</span>) in <var>subject</var>'s parent's <span>block flow
57501-
direction</span> is less than the same-axis dimension of the <span>viewport</span>, and otherwise
57502-
is the value that would place the element's <span>margin edge</span> on the side that corresponds
57503-
to <var>subject</var>'s parent's <span>block-start</span> side at the same-side edge of the
57504-
<span>viewport</span>.</p>
57505-
57506-
<p>If there is a <code>dialog</code> element with <span>centered alignment</span> and that is
57507-
<span>being rendered</span> when its <span>browsing context</span> changes <span>viewport</span>
57508-
dimensions (as measured in <span data-x="'px'">CSS pixels</span>), or when this
57509-
<code>dialog</code> element's parent changes <span>block flow direction</span>, then the user
57510-
agent must recreate the element's boxes, recalculating its edge that corresponds to this
57511-
<code>dialog</code> element's parent's <span>block-start</span> edge as in the previous
57512-
paragraph.</p>
57513-
57514-
<p>This static position of a <code>dialog</code> element's edge with <span>centered
57515-
alignment</span> must remain the element's static position of that edge until its boxes are
57516-
recreated. (The element's static position is only used in calculating the <span>used value</span>
57517-
of the appropriate box offset property (<span>'top'</span>, <span>'right'</span>,
57518-
<span>'bottom'</span>, or <span>'left'</span>) in certain situations; it's not used, for instance,
57519-
to position the element if its <span>'position'</span> property is set to
57520-
<span>'static'</span>.)</p>
57521-
57522-
<p>User agents in visual interactive media should allow the user to pan the <span>viewport</span>
57523-
to access all parts of a <code>dialog</code> element's <span>border box</span>, even if the
57524-
element is larger than the <span>viewport</span> and the <span>viewport</span> would otherwise not
57525-
have a scroll mechanism (e.g. because the <span>viewport</span>'s <span>'overflow'</span> property
57526-
is set to <span>'hidden'</span>).</p>
57490+
<p>Each <code>dialog</code> element has an <dfn>is modal</dfn> flag. When a <code>dialog</code>
57491+
element is created, this flag must be set to false.</p>
5752757492

5752857493
<hr>
5752957494

@@ -114374,7 +114339,17 @@ form { margin-block-end: 1em; }</code></pre>
114374114339
<span>'text-align'</span> property set to 'justify' in a <span data-x="presentational
114375114340
hints">presentational hint</span>, and to <span>align descendants</span> to the left.</p>
114376114341

114342+
<p>The <code>dialog</code> element, when its <span>is modal</span> flag is true, is expected to
114343+
act as if it had a user-agent-level style sheet rule setting the following properties:</p>
114377114344

114345+
<ul>
114346+
<li><span>'position'</span> property to 'fixed'</li>
114347+
<li><span>'overflow'</span> property to 'auto'</li>
114348+
<li><span>'inset-block-start'</span> property to '0'</li>
114349+
<li><span>'inset-block-end'</span> property to '0'</li>
114350+
<li><span>'max-width'</span> property to 'calc(100% - 6px - 2em)'</li>
114351+
<li><span>'max-height'</span> property to 'calc(100% - 6px - 2em)'</li>
114352+
</ul>
114378114353

114379114354
<h4>Phrasing content</h4>
114380114355

0 commit comments

Comments
 (0)