Socket
Socket
Sign inDemoInstall

react-remove-scroll

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-remove-scroll - npm Package Compare versions

Comparing version 2.4.3 to 2.4.4

12

dist/es2015/handleScroll.js

@@ -49,4 +49,12 @@ var elementCouldBeVScrolled = function (node) {

};
var getDirectionFactor = function (axis, direction) { return (
/**
* If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,
* and then increasingly negative as you scroll towards the end of the content.
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
*/
axis === 'h' && direction === 'rtl' ? -1 : 1); };
export var handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {
var delta = sourceDelta;
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
var delta = directionFactor * sourceDelta;
// find scrollable target

@@ -61,3 +69,3 @@ var target = event.target;

var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
var elementScroll = scroll_1 - capacity - position;
var elementScroll = scroll_1 - capacity - directionFactor * position;
if (position || elementScroll) {

@@ -64,0 +72,0 @@ if (elementCouldBeScrolled(axis, target)) {

@@ -51,4 +51,12 @@ "use strict";

};
var getDirectionFactor = function (axis, direction) { return (
/**
* If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position,
* and then increasingly negative as you scroll towards the end of the content.
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
*/
axis === 'h' && direction === 'rtl' ? -1 : 1); };
exports.handleScroll = function (axis, endTarget, event, sourceDelta, noOverscroll) {
var delta = sourceDelta;
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
var delta = directionFactor * sourceDelta;
// find scrollable target

@@ -63,3 +71,3 @@ var target = event.target;

var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
var elementScroll = scroll_1 - capacity - position;
var elementScroll = scroll_1 - capacity - directionFactor * position;
if (position || elementScroll) {

@@ -66,0 +74,0 @@ if (elementCouldBeScrolled(axis, target)) {

6

package.json
{
"name": "react-remove-scroll",
"version": "2.4.3",
"version": "2.4.4",
"description": "Disables scroll outside of `children` node.",

@@ -49,4 +49,4 @@ "main": "dist/es5/index.js",

"peerDependencies": {
"react": "^16.8.0 || ^17.0.0",
"@types/react": "^16.8.0 || ^17.0.0"
"@types/react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
},

@@ -53,0 +53,0 @@ "peerDependenciesMeta": {

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