Socket
Socket
Sign inDemoInstall

scroll-into-view-if-needed

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scroll-into-view-if-needed - npm Package Compare versions

Comparing version 2.2.15 to 2.2.16

4

package.json

@@ -11,3 +11,3 @@ {

},
"version": "2.2.15",
"version": "2.2.16",
"main": "index.js",

@@ -36,3 +36,3 @@ "module": "es/index.js",

"dependencies": {
"compute-scroll-into-view": "1.0.6"
"compute-scroll-into-view": "1.0.7"
},

@@ -39,0 +39,0 @@ "devDependencies": {

@@ -199,3 +199,3 @@ [![CircleCI Status](https://img.shields.io/circleci/project/github/stipsan/scroll-into-view-if-needed.svg?style=flat-square)](https://circleci.com/gh/stipsan/scroll-into-view-if-needed)

#### block
#### [block](https://scroll-into-view-if-needed.netlify.com/#scroll-alignment)

@@ -206,6 +206,5 @@ Type: `'start' | 'center' | 'end' | 'nearest'`<br> Default: `'center'`

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.
This means that `block: 'start'` aligns to the top edge and `block: 'end'` to the bottom.
[More info.](https://github.com/stipsan/compute-scroll-into-view#block)
#### inline
#### [inline](https://scroll-into-view-if-needed.netlify.com/#scroll-alignment)

@@ -216,5 +215,5 @@ Type: `'start' | 'center' | 'end' | 'nearest'`<br> Default: `'nearest'`

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.
[More info.](https://github.com/stipsan/compute-scroll-into-view#inline)
#### scrollMode
#### [scrollMode](https://scroll-into-view-if-needed.netlify.com/#scrolling-if-needed)

@@ -225,9 +224,6 @@ Type: `'always' | 'if-needed'`<br> Default: `'always'`

This is a proposed addition to the spec that you can track here: https://github.com/w3c/csswg-drafts/pull/1805
[More info.](https://github.com/stipsan/compute-scroll-into-view#scrollmode)
This library will be updated to reflect any changes to the spec and will provide a migration path.
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).
#### [boundary](https://scroll-into-view-if-needed.netlify.com/#limit-propagation)
#### boundary
Type: `Element | Function`

@@ -237,26 +233,4 @@

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.
You can use this option to do things like:
[More info.](https://github.com/stipsan/compute-scroll-into-view#boundary)
- Prevent the browser window from scrolling.
- Scroll things into view below the fold without scrolling to it.
- Scroll elements into view in a list, without scrolling container elements.
- Prematurely optimizing performance instead of code-splitting your app.
You can also pass a function to do more dynamic checks to override the scroll scoping:
```js
scrollIntoView(target, {
boundary: parent => {
// By default `overflow: hidden` elements are allowed, only `overflow: visible | clip` is skipped as
// this is required by the CSSOM spec
if (getComputedStyle(parent)['overflow'] === 'hidden') {
return false
}
return true
},
})
```
#### skipOverflowHiddenElements

@@ -268,6 +242,4 @@

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.
[More info.](https://github.com/stipsan/compute-scroll-into-view#skipoverflowhiddenelements)
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.
# TypeScript support

@@ -274,0 +246,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc