Skip to content

Commit feb319d

Browse files
committed
Specify scroll restoration in more detail
Closes #7517.
1 parent ae3c911 commit feb319d

File tree

1 file changed

+46
-12
lines changed

1 file changed

+46
-12
lines changed

source

Lines changed: 46 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92955,10 +92955,8 @@ location.href = '#foo';</code></pre>
9295592955
<ol>
9295692956
<li>
9295792957
<p>If <var>entry</var>'s <span data-x="she-scroll-restoration-mode">scroll restoration
92958-
mode</span> is "<code data-x="dom-ScrollRestoration-auto">auto</code>", then the user agent may
92959-
use <var>entry</var>'s <span data-x="she-scroll-position">scroll position data</span> to restore
92960-
the scroll positions of <var>entry</var>'s <span data-x="she-document">document</span>'s
92961-
<span>restorable scrollable regions</span>.</p>
92958+
mode</span> is "<code data-x="dom-ScrollRestoration-auto">auto</code>", then <span>restore
92959+
scroll position data</span> given <var>entry</var>.</p>
9296292960

9296392961
<p class="note">The user agent not restoring scroll positions does not imply that scroll
9296492962
positions will be left at any particular value (e.g., (0,0)). The actual scroll position depends
@@ -92989,14 +92987,45 @@ location.href = '#foo';</code></pre>
9298992987

9299092988
<hr>
9299192989

92992-
<p>The <dfn>restorable scrollable regions</dfn> of a <code>Document</code> <var>document</var> are
92993-
<var>document</var>'s <span>viewport</span>, and all of <var>document</var>'s scrollable regions
92994-
excepting any <span data-x="navigable container">navigable containers</span>.</p>
92990+
<p>Each <code>Document</code> has a boolean <dfn>has been scrolled by the user</dfn>, initially
92991+
false. If the user scrolls the document, the user agent must set that document's <span>has been
92992+
scrolled by the user</span> to true.</p>
92993+
92994+
<p>The <dfn>restorable scrollable regions</dfn> of a <code>Document</code> <var>document</var>
92995+
are <var>document</var>'s <span>viewport</span>, and all of <var>document</var>'s scrollable
92996+
regions excepting any <span data-x="navigable container">navigable containers</span>.</p>
9299592997

9299692998
<p class="note"><span>Child navigable</span> scroll restoration is handled as part of state
9299792999
restoration for the <span>session history entry</span> for those <span
9299893000
data-x="navigable">navigables</span>' <code>Document</code>s.</p>
9299993001

93002+
<p>To <dfn>restore scroll position data</dfn> given a <span>session history entry</span>
93003+
<var>entry</var>:</p>
93004+
93005+
<ol>
93006+
<li><p>Let <var>document</var> be <var>entry</var>'s <span
93007+
data-x="she-document">document</span>.</p></li>
93008+
93009+
<li><p>If <var>document</var>'s <span>has been scrolled by the user</span> is true, then the
93010+
user agent should return.</p></li>
93011+
93012+
<li>
93013+
<p>The user agent should attempt to use <var>entry</var>'s <span
93014+
data-x="she-scroll-position">scroll position data</span> to restore the scroll positions of
93015+
<var>entry</var>'s <span data-x="she-document">document</span>'s <span>restorable scrollable
93016+
regions</span>. The user agnet may continue to attempt to do so periodically, until
93017+
<var>document</var>'s <span>has been scrolled by the user</span> becomes true.</p>
93018+
93019+
<p class="note">This is formulated as an <em>attempt</em>, which is potentially repeated until
93020+
success or until the user scrolls, due to the fact that relevant content indicated by the <span
93021+
data-x="she-scroll-position">scroll position data</span> might take some time to load from the
93022+
network.</p>
93023+
93024+
<p class="note">Scroll restoration might be affected by scroll anchoring. <ref
93025+
spec=CSSSCROLLANCHORING></p>
93026+
</li>
93027+
</ol>
93028+
9300093029

9300193030
<h3 split-filename="document-lifecycle">Document lifecycle</h3>
9300293031

@@ -93879,6 +93908,8 @@ new PaymentRequest(&hellip;); // Allowed to use
9387993908
<span data-x="map get the keys">getting the keys</span> for the
9388093909
<span>map of active timers</span>.</p></li>
9388193910

93911+
<li><p>Set <var>oldDocument</var>'s <span>has been scrolled by the user</span> to false.</p></li>
93912+
9388293913
<li><p>Run any <span>unloading document cleanup steps</span> for <var>oldDocument</var> that are
9388393914
defined by this specification and <span>other applicable specifications</span>.</p></li>
9388493915

@@ -131113,15 +131144,15 @@ INSERT INTERFACES HERE
131113131144
<dt id="refsCSSSIZING">[CSSSIZING]</dt>
131114131145
<dd><cite><a href="https://drafts.csswg.org/css-sizing/">CSS Intrinsic &amp; Extrinsic Sizing Module</a></cite>, T. Atkins, E. Etemad. W3C.</dd>
131115131146

131116-
<dt id="refsCSSTRANSITIONS">[CSSTRANSITIONS]</dt>
131117-
<dd>(Non-normative) <cite><a href="https://drafts.csswg.org/css-transitions/">CSS Transitions</a></cite>, D. Jackson, D. Hyatt, C. Marrin, L. Baron. W3C.</dd>
131118-
131119-
<dt id="refsCSSUI">[CSSUI]</dt>
131120-
<dd><cite><a href="https://drafts.csswg.org/css-ui/">CSS3 Basic User Interface Module</a></cite>, T. &Ccedil;elik. W3C.</dd>
131147+
<dt id="refsCSSSCROLLANCHORING">[CSSSCROLLANCHORING]</dt>
131148+
<dd>(Non-normative) <cite><a href="https://drafts.csswg.org/css-scroll-anchoring/">CSS Scroll Anchoring</a></cite>, T. Atkins-Bittner. W3C.</dd>
131121131149

131122131150
<dt id="refsCSSSYNTAX">[CSSSYNTAX]</dt>
131123131151
<dd><cite><a href="https://drafts.csswg.org/css-syntax/">CSS Syntax</a></cite>, T. Atkins, S. Sapin. W3C.</dd>
131124131152

131153+
<dt id="refsCSSTRANSITIONS">[CSSTRANSITIONS]</dt>
131154+
<dd>(Non-normative) <cite><a href="https://drafts.csswg.org/css-transitions/">CSS Transitions</a></cite>, L. Baron, D. Jackson, B. Birtles. W3C.</dd>
131155+
131125131156
<dt id="refsCSSTABLE">[CSSTABLE]</dt>
131126131157
<dd><cite><a href="https://drafts.csswg.org/css-tables/">CSS Table</a></cite>, F. Remy, G. Whitworth. W3C.</dd>
131127131158

@@ -131131,6 +131162,9 @@ INSERT INTERFACES HERE
131131131162
<dt id="refsCSSVALUES">[CSSVALUES]</dt>
131132131163
<dd><cite><a href="https://drafts.csswg.org/css-values/">CSS3 Values and Units</a></cite>, H. Lie, T. Atkins, E. Etemad. W3C.</dd>
131133131164

131165+
<dt id="refsCSSUI">[CSSUI]</dt>
131166+
<dd><cite><a href="https://drafts.csswg.org/css-ui/">CSS3 Basic User Interface Module</a></cite>, F. Rivoal. W3C.</dd>
131167+
131134131168
<dt id="refsCSSWM">[CSSWM]</dt>
131135131169
<dd><cite><a href="https://drafts.csswg.org/css-writing-modes/">CSS Writing Modes</a></cite>, E. Etemad, K. Ishii. W3C.</dd>
131136131170

0 commit comments

Comments
 (0)