Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.5.6 to 2.5.7

13

dist/es2015/handleScroll.js

@@ -83,3 +83,8 @@ var alwaysContainsScroll = function (node) {

}
target = target.parentNode;
if (target instanceof ShadowRoot) {
target = target.host;
}
else {
target = target.parentNode;
}
} while (

@@ -90,7 +95,9 @@ // portaled content

(targetInLock && (endTarget.contains(target) || endTarget === target)));
if (isDeltaPositive && ((noOverscroll && availableScroll === 0) || (!noOverscroll && delta > availableScroll))) {
// handle epsilon around 0 (non standard zoom levels)
if (isDeltaPositive &&
((noOverscroll && Math.abs(availableScroll) < 1) || (!noOverscroll && delta > availableScroll))) {
shouldCancelScroll = true;
}
else if (!isDeltaPositive &&
((noOverscroll && availableScrollTop === 0) || (!noOverscroll && -delta > availableScrollTop))) {
((noOverscroll && Math.abs(availableScrollTop) < 1) || (!noOverscroll && -delta > availableScrollTop))) {
shouldCancelScroll = true;

@@ -97,0 +104,0 @@ }

@@ -86,3 +86,3 @@ import { __spreadArray } from "tslib";

var delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);
var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && e.target === event.target && deltaCompare(e.delta, delta); })[0];
var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta); })[0];
// self event, and should be canceled

@@ -110,3 +110,3 @@ if (sourceEvent && sourceEvent.should) {

var shouldCancel = React.useCallback(function (name, delta, target, should) {
var event = { name: name, delta: delta, target: target, should: should };
var event = { name: name, delta: delta, target: target, should: should, shadowParent: getOutermostShadowParent(target) };
shouldPreventQueue.current.push(event);

@@ -149,1 +149,12 @@ setTimeout(function () {

}
function getOutermostShadowParent(node) {
var shadowParent = null;
while (node !== null) {
if (node instanceof ShadowRoot) {
shadowParent = node.host;
node = node.host;
}
node = node.parentNode;
}
return shadowParent;
}

@@ -71,3 +71,8 @@ const alwaysContainsScroll = (node) =>

}
target = target.parentNode;
if (target instanceof ShadowRoot) {
target = target.host;
}
else {
target = target.parentNode;
}
} while (

@@ -78,7 +83,9 @@ // portaled content

(targetInLock && (endTarget.contains(target) || endTarget === target)));
if (isDeltaPositive && ((noOverscroll && availableScroll === 0) || (!noOverscroll && delta > availableScroll))) {
// handle epsilon around 0 (non standard zoom levels)
if (isDeltaPositive &&
((noOverscroll && Math.abs(availableScroll) < 1) || (!noOverscroll && delta > availableScroll))) {
shouldCancelScroll = true;
}
else if (!isDeltaPositive &&
((noOverscroll && availableScrollTop === 0) || (!noOverscroll && -delta > availableScrollTop))) {
((noOverscroll && Math.abs(availableScrollTop) < 1) || (!noOverscroll && -delta > availableScrollTop))) {
shouldCancelScroll = true;

@@ -85,0 +92,0 @@ }

@@ -84,3 +84,3 @@ import * as React from 'react';

const delta = 'deltaY' in event ? getDeltaXY(event) : getTouchXY(event);
const sourceEvent = shouldPreventQueue.current.filter((e) => e.name === event.type && e.target === event.target && deltaCompare(e.delta, delta))[0];
const sourceEvent = shouldPreventQueue.current.filter((e) => e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta))[0];
// self event, and should be canceled

@@ -108,3 +108,3 @@ if (sourceEvent && sourceEvent.should) {

const shouldCancel = React.useCallback((name, delta, target, should) => {
const event = { name, delta, target, should };
const event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
shouldPreventQueue.current.push(event);

@@ -147,1 +147,12 @@ setTimeout(() => {

}
function getOutermostShadowParent(node) {
let shadowParent = null;
while (node !== null) {
if (node instanceof ShadowRoot) {
shadowParent = node.host;
node = node.host;
}
node = node.parentNode;
}
return shadowParent;
}

@@ -87,3 +87,8 @@ "use strict";

}
target = target.parentNode;
if (target instanceof ShadowRoot) {
target = target.host;
}
else {
target = target.parentNode;
}
} while (

@@ -94,7 +99,9 @@ // portaled content

(targetInLock && (endTarget.contains(target) || endTarget === target)));
if (isDeltaPositive && ((noOverscroll && availableScroll === 0) || (!noOverscroll && delta > availableScroll))) {
// handle epsilon around 0 (non standard zoom levels)
if (isDeltaPositive &&
((noOverscroll && Math.abs(availableScroll) < 1) || (!noOverscroll && delta > availableScroll))) {
shouldCancelScroll = true;
}
else if (!isDeltaPositive &&
((noOverscroll && availableScrollTop === 0) || (!noOverscroll && -delta > availableScrollTop))) {
((noOverscroll && Math.abs(availableScrollTop) < 1) || (!noOverscroll && -delta > availableScrollTop))) {
shouldCancelScroll = true;

@@ -101,0 +108,0 @@ }

@@ -91,3 +91,3 @@ "use strict";

var delta = 'deltaY' in event ? (0, exports.getDeltaXY)(event) : (0, exports.getTouchXY)(event);
var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && e.target === event.target && deltaCompare(e.delta, delta); })[0];
var sourceEvent = shouldPreventQueue.current.filter(function (e) { return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta); })[0];
// self event, and should be canceled

@@ -115,3 +115,3 @@ if (sourceEvent && sourceEvent.should) {

var shouldCancel = React.useCallback(function (name, delta, target, should) {
var event = { name: name, delta: delta, target: target, should: should };
var event = { name: name, delta: delta, target: target, should: should, shadowParent: getOutermostShadowParent(target) };
shouldPreventQueue.current.push(event);

@@ -155,1 +155,12 @@ setTimeout(function () {

exports.RemoveScrollSideCar = RemoveScrollSideCar;
function getOutermostShadowParent(node) {
var shadowParent = null;
while (node !== null) {
if (node instanceof ShadowRoot) {
shadowParent = node.host;
node = node.host;
}
node = node.parentNode;
}
return shadowParent;
}
{
"name": "react-remove-scroll",
"version": "2.5.6",
"version": "2.5.7",
"description": "Disables scroll outside of `children` node.",

@@ -5,0 +5,0 @@ "main": "dist/es5/index.js",

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