Skip to content

Commit 0be9783

Browse files
committed
[css-position-4] Expand/rewrite the overlay guidance to make it clearer exactly what its purpose is. w3c#8730
1 parent 8c61ed4 commit 0be9783

1 file changed

Lines changed: 44 additions & 16 deletions

File tree

css-position-4/Overview.bs

Lines changed: 44 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,17 @@ Top Layer Manipulation {#top-manip}
574574
see [[#overlay]] for details.
575575
</div>
576576

577+
578+
<!--
579+
███████ ██ ██ ████████ ████████ ██ ███ ██ ██
580+
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
581+
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████
582+
██ ██ ██ ██ ██████ ████████ ██ ██ ██ ██
583+
██ ██ ██ ██ ██ ██ ██ ██ █████████ ██
584+
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
585+
███████ ███ ████████ ██ ██ ████████ ██ ██ ██
586+
-->
587+
577588
Controlling the Top Layer: the 'overlay' property {#overlay}
578589
-------------------------------------------------
579590

@@ -585,49 +596,66 @@ Inherited: no
585596
Animation Type: (see prose)
586597
</pre>
587598

588-
The 'overlay' property determines and reflects
589-
whether an element is in the [=Document/top layer=] or not.
590-
Its values are:
599+
The 'overlay' property is used to help determine
600+
whether an element should be in the [=Document/top layer=] or not.
591601

592602
<dl dfn-type=value dfn-for=overlay>
593603
: <dfn>none</dfn>
594-
:: The element is not in the [=Document/top layer=].
604+
:: The element shouldn't be in the [=Document/top layer=].
595605

596606
: <dfn>auto</dfn>
597-
:: The element is rendered as part of the [=Document/top layer=].
607+
:: The element should be in the [=Document/top layer=].
598608
Rather than generating boxes as part of its normal position in the document,
599609
it generates boxes as a sibling of the root element.
600610
</dl>
601611

612+
<div class=note id=overlay-guidance>
613+
Note: 'overlay' is a somewhat unusual property:
614+
it is <em>only</em> set by the user agent,
615+
and can't be set by authors <em>at all</em>.
616+
As well, it has almost no effect:
617+
an element is [=rendered in the top layer=]
618+
as soon as it's [=in the top layer=]
619+
and stops as soon as it's not;
620+
the 'overlay' property doesn't affect this.
621+
622+
However, when the user agent wants to remove an element from the [=Document/top layer=],
623+
it checks 'overlay' first;
624+
if it's still ''overlay/auto'',
625+
it delays the removal until it's ''overlay/none''.
626+
The user agent is in control of when it goes from ''overlay/auto'' to ''overlay/none'',
627+
but authors <em>can</em> set a 'transition' on 'overlay',
628+
delaying its change.
629+
630+
This delay period can then be paired with other animations or transitions
631+
to create an "exit animation"--
632+
animating the element leaving the top layer,
633+
for example by fading its 'opacity'--
634+
without it <em>also</em> immediately rendering back in the normal document
635+
and possibly becoming obscured.
636+
</div>
637+
602638
For animation,
603639
''overlay/auto'' is [=interpolated=] as a discrete step
604640
where values of p such that <code>0 < p < 1</code>
605641
map to ''overlay/auto''
606642
and other values of p map to the closer endpoint;
607643
if neither value is ''overlay/auto'' then discrete animation is used.
608644

645+
Note: This is similar to how 'visibility' animates.
646+
609647
User agents must have the following rule in their UA stylesheet:
610648

611649
<pre highlight=css>
612650
* { overlay: none !important; }
613651
</pre>
614652

615-
This means that the 'overlay' property <em>cannot be set by authors or users</em>--
653+
Note: This means that the 'overlay' property <em>cannot be set by authors or users</em>--
616654
it is entirely controlled by the user agent
617655
(which sets elements to ''overlay: auto'',
618656
via another UA-!important rule,
619657
when they're in the [=Document/top layer=]).
620658

621-
However, authors <em>can</em> set a [=transition=] on 'overlay',
622-
forcing it to stay ''overlay/auto'' for a period of time
623-
(keeping the element in the [=Document/top layer=])
624-
so an "exit animation" can be used on the element
625-
(such as fading it out,
626-
moving it offscreen,
627-
scaling it down,
628-
etc)
629-
before it goes back to its normal, non-top-layer rendering.
630-
631659
User agents <em>may</em>, at their discretion,
632660
remove a running [=transition=] on 'overlay'.
633661
The conditions for this are intentionally undefined.

0 commit comments

Comments
 (0)