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
Copy file name to clipboardExpand all lines: README.md
+9-37
Original file line number
Diff line number
Diff line change
@@ -196,73 +196,45 @@ Check the demo to see an [example with popmotion and a spring transition](https:
196
196
197
197
> If you only need the custom behavior you might be better off by using the compute library directly: https://github.com/stipsan/compute-scroll-into-view
Control the logical scroll position on the y-axis. The spec states that the `block` direction is related to the [writing-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode), but this is not implemented yet in this library.
206
-
This means that `block: 'start'` aligns to the top edge and `block: 'end'` to the bottom.
Like `block` this is affected by the [writing-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode). In left-to-right pages `inline: 'start'` will align to the left edge. In right-to-left it should be flipped. This will be supported in a future release.
This library will be updated to reflect any changes to the spec and will provide a migration path.
225
-
To be backwards compatible with `Element.scrollIntoViewIfNeeded` if something is not 100% visible it will count as "needs scrolling". If you need a different visibility ratio your best option would be to implement an [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API).
> `Function` introduced in `v2.1.0`, `Element` introduced in `v1.1.0`
232
228
233
-
By default there is no boundary. All the parent elements of your target is checked until it reaches the viewport (`document.documentElement`) when calculating layout and what to scroll.
234
-
You can use this option to do things like:
235
-
236
-
- Prevent the browser window from scrolling.
237
-
- Scroll things into view below the fold without scrolling to it.
238
-
- Scroll elements into view in a list, without scrolling container elements.
239
-
- Prematurely optimizing performance instead of code-splitting your app.
240
-
241
-
You can also pass a function to do more dynamic checks to override the scroll scoping:
242
-
243
-
```js
244
-
scrollIntoView(target, {
245
-
boundary:parent=> {
246
-
// By default `overflow: hidden` elements are allowed, only `overflow: visible | clip` is skipped as
247
-
// this is required by the CSSOM spec
248
-
if (getComputedStyle(parent)['overflow'] ==='hidden') {
By default the [spec](https://drafts.csswg.org/cssom-view/#scrolling-box) states that `overflow: hidden` elements should be scrollable because it has [been used to allow programatic scrolling](https://drafts.csswg.org/css-overflow-3/#valdef-overflow-hidden). This behavior can sometimes lead to [scrolling issues](https://github.com/stipsan/scroll-into-view-if-needed/pull/225#issue-186419520) when you have a node that is a child of an `overflow: hidden` node.
264
-
265
-
This package follows the convention [adopted by Firefox](https://hg.mozilla.org/integration/fx-team/rev/c48c3ec05012#l7.18) of setting a boolean option to _not_ scroll all nodes with `overflow: hidden` set.
0 commit comments