Skip to content

Commit f606ad4

Browse files
committed
docs: say what things are, not what they are not
Three sentences defined something by naming a category it does not belong to. Each one assumed the reader was mid-mistake, and none of them said anything actionable, since the real advice was always in the sentences around them. "A fallback is not a loading strategy" was a topic sentence for a paragraph that already gives the advice. Deleted; the paragraph reads better without it. "Reach for it when a scroller inside the root clips the target, not when you want to adjust the viewport" both repeated the sentence before it and corrected a reader who had not done anything. `scrollMargin` is now described once, and the section on where to observe is where you find out when to use it. "It is not a layout ratio" guarded a genuine trap, since `mockAllIsIntersecting(0.3)` does look like thirty percent visible. Naming what the number does select, which of your configured thresholds the observer crossed, closes the same trap without the correction. Left the README FAQ line about `root` not being the viewport. That section answers a reader who has already hit the problem and gone looking, so telling them what is not true is the answer they came for.
1 parent 1254254 commit f606ad4

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎apps/docs/docs/api/configuration.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ useInView({
2424
});
2525
```
2626

27-
`scrollMargin` grows or shrinks the clipping rectangles of nested scroll containers. Reach for it when a scroller inside the root clips the target, not when you want to adjust the viewport.
27+
`scrollMargin` grows or shrinks the clipping rectangles of scroll containers nested inside the root.
2828

2929
## Choose where to observe
3030

‎apps/docs/docs/guides/ssr.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ Pick `true` when content should count as visible even without observation. Pick
4141

4242
Hydration attaches the observer once the browser takes over, so nothing is observed during the server render. `entry` is `undefined` until an accepted notification arrives, and reading geometry from it on the server will fail.
4343

44-
A fallback is not a loading strategy. If the server renders hidden content and the client immediately renders it visible, reserve the layout space and keep the change accessible. Give images dimensions and consider native `loading="lazy"`. For content that matters, make sure it is still reachable when observation is unavailable.
44+
If the server renders hidden content and the client immediately renders it visible, reserve the layout space and keep the change accessible. Give images dimensions and consider native `loading="lazy"`. For content that matters, make sure it is still reachable when observation is unavailable.

‎apps/docs/docs/testing/mocking-intersections.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ test("ignores the initial false notification", () => {
103103
});
104104
```
105105

106-
Pass a boolean to enter or leave. A number selects which configured thresholds the observer has crossed. It is not a layout ratio: the mock reports the highest crossed threshold as `entry.intersectionRatio`. Assert threshold behavior, not raw geometry or an arbitrary percentage.
106+
Pass a boolean to enter or leave. A number selects which of the configured thresholds the observer has crossed, and the mock reports the highest crossed one as `entry.intersectionRatio`. Assert against the thresholds you configured.
107107

108108
These examples work the same in Vitest and Jest. Switch to [Browser Mode](/testing/browser-mode) when a test has to prove real browser behavior.
109109

0 commit comments

Comments
 (0)