You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[cssom-view] Change scrollIntoView({}) to center, and add "nearest"
* Change default value of ScrollIntoViewOptions to center/center.
* Add a "nearest" value to ScrollLogicalPosition.
* scrollIntoView() and scrollIntoView(true|false) use start/end for
block flow direction and nearest for inline base direction.
@@ -1056,7 +1056,8 @@ The <dfn method for=Element>scrollIntoView(<var>arg</var>)</dfn> method must run
1056
1056
1. Let <var>options</var> be null.
1057
1057
1. If <var>arg</var> is an object, let <var>options</var> be <var>arg</var>.
1058
1058
1. <a lt="converted to an IDL value">Convert</a><var>options</var> to a {{ScrollIntoViewOptions}} dictionary. [[!WEBIDL]]
1059
-
1. If <var>arg</var> is false, let the {{ScrollIntoViewOptions/block}} dictionary member of <var>options</var> have the value "<code>end</code>".
1059
+
1. If <var>arg</var> is not specified or is true, let the {{ScrollIntoViewOptions/block}} dictionary member of <var>options</var> have the value "<code>start</code>", and let the {{ScrollIntoViewOptions/inline}} dictionary member of <var>options</var> have the value "<code>nearest</code>".
1060
+
1. If <var>arg</var> is false, let the {{ScrollIntoViewOptions/block}} dictionary member of <var>options</var> have the value "<code>end</code>", and let the {{ScrollIntoViewOptions/inline}} dictionary member of <var>options</var> have the value "<code>nearest</code>".
1060
1061
1. If the element does not have any associated <a>layout box</a> terminate these steps.
1061
1062
1. <a lt='scroll an element into view'>Scroll the element into view</a>
1062
1063
with the options <var>options</var>.
@@ -1236,11 +1237,24 @@ a <a>scrolling box</a> <var>scrolling box</var>, in order of innermost to outerm
1236
1237
1237
1238
1. If the {{ScrollIntoViewOptions/block}} dictionary member of <var>options</var> is "start", align <var>element edge A</var> with <var>scrolling box edge A</var>.
1238
1239
1. Otherwise, if the {{ScrollIntoViewOptions/block}} dictionary member of <var>options</var> is "end"; align <var>element edge B</var> with <var>scrolling box edge B</var>.
1239
-
1. Otherwise, it is "center"; align the center of <var>element bounding border box</var> with the center of <var>scrolling box</var> in <var>scrolling box</var>'s <a>block flow direction</a>.
1240
+
1. Otherwise, if the {{ScrollIntoViewOptions/block}} dictionary member of <var>options</var> is "center"; align the center of <var>element bounding border box</var> with the center of <var>scrolling box</var> in <var>scrolling box</var>'s <a>block flow direction</a>.
1241
+
1. Otherwise, it is "nearest"; follow these steps:
1242
+
<dl class=switch>
1243
+
<dt>If <var>element edge A</var> and <var>element edge B</var> are both outside <var>scrolling box edge A</var> and <var>scrolling box edge B</var>
1244
+
<dd>Do nothing.
1245
+
1246
+
<dt>If <var>element edge A</var> is outside <var>scrolling box edge A</var> and <var>element width</var> is less than <var>scrolling box width</var>
1247
+
<dt>If <var>element edge B</var> is outside <var>scrolling box edge B</var> and <var>element width</var> is greater than <var>scrolling box width</var>
1248
+
<dd>Align <var>element edge A</var> with <var>scrolling box edge A</var>.
1249
+
1250
+
<dt>If <var>element edge A</var> is outside <var>scrolling box edge A</var> and <var>element width</var> is greater than <var>scrolling box width</var>
1251
+
<dt>If <var>element edge B</var> is outside <var>scrolling box edge B</var> and <var>element width</var> is less than <var>scrolling box width</var>
1252
+
<dd>Align <var>element edge B</var> with <var>scrolling box edge B</var>.
1253
+
</dl>
1240
1254
1. If the {{ScrollIntoViewOptions/inline}} dictionary member of <var>options</var> is "start", align <var>element edge C</var> with <var>scrolling box edge C</var>.
1241
1255
1. Otherwise, if the {{ScrollIntoViewOptions/inline}} dictionary member of <var>options</var> is "end"; align <var>element edge D</var> with <var>scrolling box edge D</var>.
1242
1256
1. Otherwise, if the {{ScrollIntoViewOptions/inline}} dictionary member of <var>options</var> is "center", align the center of <var>element bounding border box</var> with the center of <var>scrolling box</var> in <var>scrolling box</var>'s <a>inline base direction</a>.
1243
-
1. Otherwise, it is not set; follow these steps:
1257
+
1. Otherwise, it is "nearest"; follow these steps:
1244
1258
<dl class=switch>
1245
1259
<dt>If <var>element edge C</var> and <var>element edge D</var> are both outside <var>scrolling box edge C</var> and <var>scrolling box edge D</var>
0 commit comments