Skip to content

Commit 67994b2

Browse files
authored
Specify scroll restoration in more detail
Closes whatwg#7517.
1 parent 430582c commit 67994b2

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
@@ -93037,10 +93037,8 @@ location.href = '#foo';</code></pre>
9303793037
<ol>
9303893038
<li>
9303993039
<p>If <var>entry</var>'s <span data-x="she-scroll-restoration-mode">scroll restoration
93040-
mode</span> is "<code data-x="dom-ScrollRestoration-auto">auto</code>", then the user agent may
93041-
use <var>entry</var>'s <span data-x="she-scroll-position">scroll position data</span> to restore
93042-
the scroll positions of <var>entry</var>'s <span data-x="she-document">document</span>'s
93043-
<span>restorable scrollable regions</span>.</p>
93040+
mode</span> is "<code data-x="dom-ScrollRestoration-auto">auto</code>", then <span>restore
93041+
scroll position data</span> given <var>entry</var>.</p>
9304493042

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

9307293070
<hr>
9307393071

93074-
<p>The <dfn>restorable scrollable regions</dfn> of a <code>Document</code> <var>document</var> are
93075-
<var>document</var>'s <span>viewport</span>, and all of <var>document</var>'s scrollable regions
93076-
excepting any <span data-x="navigable container">navigable containers</span>.</p>
93072+
<p>Each <code>Document</code> has a boolean <dfn>has been scrolled by the user</dfn>, initially
93073+
false. If the user scrolls the document, the user agent must set that document's <span>has been
93074+
scrolled by the user</span> to true.</p>
93075+
93076+
<p>The <dfn>restorable scrollable regions</dfn> of a <code>Document</code> <var>document</var>
93077+
are <var>document</var>'s <span>viewport</span>, and all of <var>document</var>'s scrollable
93078+
regions excepting any <span data-x="navigable container">navigable containers</span>.</p>
9307793079

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

93084+
<p>To <dfn>restore scroll position data</dfn> given a <span>session history entry</span>
93085+
<var>entry</var>:</p>
93086+
93087+
<ol>
93088+
<li><p>Let <var>document</var> be <var>entry</var>'s <span
93089+
data-x="she-document">document</span>.</p></li>
93090+
93091+
<li><p>If <var>document</var>'s <span>has been scrolled by the user</span> is true, then the
93092+
user agent should return.</p></li>
93093+
93094+
<li>
93095+
<p>The user agent should attempt to use <var>entry</var>'s <span
93096+
data-x="she-scroll-position">scroll position data</span> to restore the scroll positions of
93097+
<var>entry</var>'s <span data-x="she-document">document</span>'s <span>restorable scrollable
93098+
regions</span>. The user agent may continue to attempt to do so periodically, until
93099+
<var>document</var>'s <span>has been scrolled by the user</span> becomes true.</p>
93100+
93101+
<p class="note">This is formulated as an <em>attempt</em>, which is potentially repeated until
93102+
success or until the user scrolls, due to the fact that relevant content indicated by the <span
93103+
data-x="she-scroll-position">scroll position data</span> might take some time to load from the
93104+
network.</p>
93105+
93106+
<p class="note">Scroll restoration might be affected by scroll anchoring. <ref
93107+
spec=CSSSCROLLANCHORING></p>
93108+
</li>
93109+
</ol>
93110+
9308293111

9308393112
<h3 split-filename="document-lifecycle">Document lifecycle</h3>
9308493113

@@ -93961,6 +93990,8 @@ new PaymentRequest(&hellip;); // Allowed to use
9396193990
<span data-x="map get the keys">getting the keys</span> for the
9396293991
<span>map of active timers</span>.</p></li>
9396393992

93993+
<li><p>Set <var>oldDocument</var>'s <span>has been scrolled by the user</span> to false.</p></li>
93994+
9396493995
<li><p>Run any <span>unloading document cleanup steps</span> for <var>oldDocument</var> that are
9396593996
defined by this specification and <span>other applicable specifications</span>.</p></li>
9396693997

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

130911-
<dt id="refsCSSTRANSITIONS">[CSSTRANSITIONS]</dt>
130912-
<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>
130913-
130914-
<dt id="refsCSSUI">[CSSUI]</dt>
130915-
<dd><cite><a href="https://drafts.csswg.org/css-ui/">CSS3 Basic User Interface Module</a></cite>, T. &Ccedil;elik. W3C.</dd>
130942+
<dt id="refsCSSSCROLLANCHORING">[CSSSCROLLANCHORING]</dt>
130943+
<dd>(Non-normative) <cite><a href="https://drafts.csswg.org/css-scroll-anchoring/">CSS Scroll Anchoring</a></cite>, T. Atkins-Bittner. W3C.</dd>
130916130944

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

130948+
<dt id="refsCSSTRANSITIONS">[CSSTRANSITIONS]</dt>
130949+
<dd>(Non-normative) <cite><a href="https://drafts.csswg.org/css-transitions/">CSS Transitions</a></cite>, L. Baron, D. Jackson, B. Birtles. W3C.</dd>
130950+
130920130951
<dt id="refsCSSTABLE">[CSSTABLE]</dt>
130921130952
<dd><cite><a href="https://drafts.csswg.org/css-tables/">CSS Table</a></cite>, F. Remy, G. Whitworth. W3C.</dd>
130922130953

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

130960+
<dt id="refsCSSUI">[CSSUI]</dt>
130961+
<dd><cite><a href="https://drafts.csswg.org/css-ui/">CSS3 Basic User Interface Module</a></cite>, F. Rivoal. W3C.</dd>
130962+
130929130963
<dt id="refsCSSWM">[CSSWM]</dt>
130930130964
<dd><cite><a href="https://drafts.csswg.org/css-writing-modes/">CSS Writing Modes</a></cite>, E. Etemad, K. Ishii. W3C.</dd>
130931130965

0 commit comments

Comments
 (0)