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 1.0.2 to 1.0.3

3

dist/es2015/component.js

@@ -19,3 +19,4 @@ import * as tslib_1 from "tslib";

_this.shouldPrevent = function (event) {
if (RemoveScroll.stack[RemoveScroll.stack.length - 1] !== _this) {
var stack = RemoveScroll.stack.filter(function (el) { return el.props.enabled; });
if (!stack.length || stack[stack.length - 1] !== _this) {
return;

@@ -22,0 +23,0 @@ }

@@ -0,1 +1,2 @@

var elementCouldBeScrolled = function (node) { return (window.getComputedStyle(node).overflowX !== 'hidden'); };
export var handleScroll = function (endTarget, event, sourceDelta) {

@@ -11,4 +12,9 @@ var delta = sourceDelta;

var scrollTop = target.scrollTop, scrollHeight = target.scrollHeight, clientHeight = target.clientHeight;
availableScroll += scrollHeight - clientHeight - scrollTop;
availableScrollTop += scrollTop;
var elementScroll = scrollHeight - clientHeight - scrollTop;
if (scrollTop || elementScroll) {
if (elementCouldBeScrolled(target)) {
availableScroll += elementScroll;
availableScrollTop += scrollTop;
}
}
target = target.parentNode;

@@ -15,0 +21,0 @@ } while ((!targetInLock && target !== document.body) ||

@@ -21,3 +21,4 @@ "use strict";

_this.shouldPrevent = function (event) {
if (RemoveScroll.stack[RemoveScroll.stack.length - 1] !== _this) {
var stack = RemoveScroll.stack.filter(function (el) { return el.props.enabled; });
if (!stack.length || stack[stack.length - 1] !== _this) {
return;

@@ -24,0 +25,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var elementCouldBeScrolled = function (node) { return (window.getComputedStyle(node).overflowX !== 'hidden'); };
exports.handleScroll = function (endTarget, event, sourceDelta) {

@@ -13,4 +14,9 @@ var delta = sourceDelta;

var scrollTop = target.scrollTop, scrollHeight = target.scrollHeight, clientHeight = target.clientHeight;
availableScroll += scrollHeight - clientHeight - scrollTop;
availableScrollTop += scrollTop;
var elementScroll = scrollHeight - clientHeight - scrollTop;
if (scrollTop || elementScroll) {
if (elementCouldBeScrolled(target)) {
availableScroll += elementScroll;
availableScrollTop += scrollTop;
}
}
target = target.parentNode;

@@ -17,0 +23,0 @@ } while ((!targetInLock && target !== document.body) ||

{
"name": "react-remove-scroll",
"version": "1.0.2",
"version": "1.0.3",
"description": "Disables scroll outside of `children` node.",

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

react-remove-scroll
====
[![NPM version](https://img.shields.io/npm/v/react-remove-scroll.svg)](https://www.npmjs.com/package/react-remove-scroll)
Disables scroll outside of `children` node.

@@ -13,3 +15,3 @@

```js
import {RemoveScroll} from 'react-remove-scroll-bar';
import {RemoveScroll} from 'react-remove-scroll';

@@ -16,0 +18,0 @@ <RemoveScroll>

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