Gathering detailed insights and metrics for react-remove-scroll
Gathering detailed insights and metrics for react-remove-scroll
Gathering detailed insights and metrics for react-remove-scroll
Gathering detailed insights and metrics for react-remove-scroll
npm install react-remove-scroll
96.1
Supply Chain
98.7
Quality
78.2
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
812 Stars
145 Commits
31 Forks
5 Watching
6 Branches
10 Contributors
Updated on 25 Nov 2024
Minified
Minified + Gzipped
TypeScript (88.39%)
JavaScript (5.54%)
CSS (5.15%)
HTML (0.92%)
Cumulative downloads
Total Downloads
Last day
-5.8%
1,503,758
Compared to previous day
Last week
3.3%
8,510,907
Compared to previous week
Last month
6.4%
35,764,512
Compared to previous month
Last year
186.1%
342,346,426
Compared to previous year
2
Disables scroll outside of children
node.
Just wrap content, which should be scrollable, and everything else would not.
1import {RemoveScroll} from 'react-remove-scroll'; 2 3<RemoveScroll> 4 Only this content would be scrollable 5</RemoveScroll>
RemoveScroll
accept following props
children
[enabled]
- activate or deactivate component behaviour without removing it.[allowPinchZoom=false]
- enabled "pinch-n-zoom" behavior. By default it might be prevented. However - pinch and zoom might break "scroll isolation", and disabled by default.[noIsolation=false]
- disables outer event capturing. Event capturing is React friendly and unlikely be a problem.
But if you are using shadowbox of some sort - you dont need it.[inert=false]
- ☠️(be careful) disables events the rest of page completely using pointer-events
except the Lock(+shards).
React portals not friendly, might lead to production issues. Enable only for rare cases, when you have to disable scrollbars somewhere on the page(except body, Lock and shards).[forwardProps]
- will forward all props to the children
[className]
- className for an internal div[removeScrollBar]
- to control scroll bar removal. Set to false, if you prefer to keep it (wheel and touch scroll is still disabled).1import {sidecar} from "react-remove-scroll"; 2import {RemoveScroll} from 'react-remove-scroll/UI'; 3 4const sidecar = sidecar(() => import('react-remove-scroll/sidecar')); 5 6<RemoveScroll sideCar={sidecar}> 7 Will load logic from a sidecar when needed 8</RemoveScroll>
Consider setting
-webkit-overflow-scrolling: touch;
on a document level for a proper mobile experience.
But default RemoveScroll will create a div to handle and capture events.
You may specify className
for it, if you need, or remove it.
The following code samples will produce the same output
1<RemoveScroll className="scroll"> 2 Only this content would be scrollable 3</RemoveScroll>
1<RemoveScroll forwardProps> 2 <div className="scroll"> //RemoveScroll will inject props to this div 3 Only this content would be scrollable 4 </div> 5</RemoveScroll>
Pick the first one if you don't need a second.
To properly size these elements please add a special className to them.
1import {RemoveScroll} from 'react-remove-scroll'; 2 3// to make "width: 100%" 4<div className={cx(classWithPositionFixed, RemoveScroll.classNames.fullWidth)} /> 5 6// to make "right:0" 7<div className={cx(classWithPositionFixed, RemoveScroll.classNames.zeroRight)} />
See react-remove-scroll-bar documentation for details.
When stacked more is active (default) only one (last) component would be active.
That could happen -
you disable scroll on the body,
you are suppressing all scroll and wheel events,
and you are ghosting the rest of the page by the inert
prop.
Only something inside Lock does exists for the browser, and that might be less than you expected.
Dont forget about shard
, dont forget - inert
is not portals friendly, dont forget - you dont need over isolation in most of the cases.
just be careful!
To do the job this library setup non passive event listener. Chrome dev tools would complain about it, as a performance no-op.
We have to use synchronous scroll/touch handler, and it may affect scrolling performance.
Consider using noIsolation
mode, if you have large scrollable areas.
This is a refactoring of another library - react-scroll-locky - to make package smaller and more react-portals friendly.
This package is relative smaller(1), more react friendly(2), works with non zero body margins(3), and has a better "overscroll" management.
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
4 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 5
Reason
Found 5/23 approved changesets -- score normalized to 2
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
38 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More