Skip to content

Commit 0c6173c

Browse files
authored
fix(README): upgrade examples and links (#364)
* fix: upgrade compute-scroll-into-view * Link to the correct library * link to examples * link to the compute readme
1 parent 1fef8aa commit 0c6173c

File tree

3 files changed

+13
-41
lines changed

3 files changed

+13
-41
lines changed

README.md

+9-37
Original file line numberDiff line numberDiff line change
@@ -196,73 +196,45 @@ Check the demo to see an [example with popmotion and a spring transition](https:
196196

197197
> 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
198198
199-
#### block
199+
#### [block](https://scroll-into-view-if-needed.netlify.com/#scroll-alignment)
200200

201201
Type: `'start' | 'center' | 'end' | 'nearest'`<br> Default: `'center'`
202202

203203
> Introduced in `v2.1.0`
204204
205-
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.
205+
[More info.](https://github.com/stipsan/compute-scroll-into-view#block)
207206

208-
#### inline
207+
#### [inline](https://scroll-into-view-if-needed.netlify.com/#scroll-alignment)
209208

210209
Type: `'start' | 'center' | 'end' | 'nearest'`<br> Default: `'nearest'`
211210

212211
> Introduced in `v2.1.0`
213212
214-
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.
213+
[More info.](https://github.com/stipsan/compute-scroll-into-view#inline)
215214

216-
#### scrollMode
215+
#### [scrollMode](https://scroll-into-view-if-needed.netlify.com/#scrolling-if-needed)
217216

218217
Type: `'always' | 'if-needed'`<br> Default: `'always'`
219218

220219
> Introduced in `v2.1.0`
221220
222-
This is a proposed addition to the spec that you can track here: https://github.com/w3c/csswg-drafts/pull/1805
221+
[More info.](https://github.com/stipsan/compute-scroll-into-view#scrollmode)
223222

224-
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).
226-
227-
#### boundary
223+
#### [boundary](https://scroll-into-view-if-needed.netlify.com/#limit-propagation)
228224

229225
Type: `Element | Function`
230226

231227
> `Function` introduced in `v2.1.0`, `Element` introduced in `v1.1.0`
232228
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') {
249-
return false
250-
}
251-
252-
return true
253-
},
254-
})
255-
```
229+
[More info.](https://github.com/stipsan/compute-scroll-into-view#boundary)
256230

257231
#### skipOverflowHiddenElements
258232

259233
Type: `Boolean`<br> Default: `false`
260234

261235
> Introduced in `v2.2.0`
262236
263-
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.
237+
[More info.](https://github.com/stipsan/compute-scroll-into-view#skipoverflowhiddenelements)
266238

267239
# TypeScript support
268240

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"typecheck": "tsc --noEmit && tsc --noEmit -p tests/typescript"
3333
},
3434
"dependencies": {
35-
"compute-scroll-into-view": "1.0.6"
35+
"compute-scroll-into-view": "1.0.7"
3636
},
3737
"devDependencies": {
3838
"@babel/cli": "7.0.0-beta.54",

yarn.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1312,9 +1312,9 @@ component-emitter@^1.2.1:
13121312
version "1.2.1"
13131313
resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.2.1.tgz#137918d6d78283f7df7a6b7c5a63e140e69425e6"
13141314

1315-
compute-scroll-into-view@1.0.6:
1316-
version "1.0.6"
1317-
resolved "https://registry.yarnpkg.com/compute-scroll-into-view/-/compute-scroll-into-view-1.0.6.tgz#8c004c1aea703f143c0928c7828eb73580863d4a"
1315+
compute-scroll-into-view@1.0.7:
1316+
version "1.0.7"
1317+
resolved "https://registry.yarnpkg.com/compute-scroll-into-view/-/compute-scroll-into-view-1.0.7.tgz#ad8dbe51093c31d60cf6c2df497b2c077bd9e7d2"
13181318

13191319
concat-map@0.0.1:
13201320
version "0.0.1"

0 commit comments

Comments
 (0)