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

react-aria-modal

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-aria-modal - npm Package Compare versions

Comparing version 2.7.0 to 2.7.1

4

CHANGELOG.md
# Changelog
## 2.7.1
- [Fix] Prevent `props.onExit` from being called twice when modal includes exit buttons.
## 2.7.0

@@ -4,0 +8,0 @@

56

dist/react-aria-modal.js

@@ -19,24 +19,26 @@ 'use strict';

function Modal(props) {
function Modal() {
var _ref;
var _temp, _this, _ret;
_classCallCheck(this, Modal);
var _this = _possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).call(this, props));
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this.getApplicationNode = function () {
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Modal.__proto__ || Object.getPrototypeOf(Modal)).call.apply(_ref, [this].concat(args))), _this), _this.getApplicationNode = function () {
if (_this.props.getApplicationNode) return _this.props.getApplicationNode();
return _this.props.applicationNode;
};
_this.checkClick = function (event) {
}, _this.checkUnderlayClick = function (event) {
if (_this.dialogNode && _this.dialogNode.contains(event.target)) return;
_this.deactivate();
};
_this.deactivate = function () {
_this.exit();
}, _this.checkDocumentKeyDown = function (event) {
if (event.key === 'Escape' || event.key === 'Esc' || event.keyCode === 27) {
_this.exit();
}
}, _this.exit = function () {
_this.props.onExit();
};
_this.checkClick = _this.checkClick.bind(_this);
_this.deactivate = _this.deactivate.bind(_this);
return _this;
}, _temp), _possibleConstructorReturn(_this, _ret);
}

@@ -59,2 +61,3 @@

}
// Timeout to ensure this happens *after* focus has moved

@@ -67,2 +70,6 @@ var applicationNode = this.getApplicationNode();

}, 0);
if (props.escapeExits) {
document.addEventListener('keydown', this.checkDocumentKeyDown);
}
}

@@ -77,2 +84,3 @@ }, {

}
document.removeEventListener('keydown', this.checkDocumentKeyDown);
}

@@ -121,3 +129,3 @@ }, {

if (props.underlayClickExits) {
underlayProps.onClick = this.checkClick;
underlayProps.onClick = this.checkUnderlayClick;
}

@@ -157,5 +165,5 @@

if (props.dialogStyle) {
for (var _key in props.dialogStyle) {
if (!props.dialogStyle.hasOwnProperty(_key)) continue;
dialogStyle[_key] = props.dialogStyle[_key];
for (var _key2 in props.dialogStyle) {
if (!props.dialogStyle.hasOwnProperty(_key2)) continue;
dialogStyle[_key2] = props.dialogStyle[_key2];
}

@@ -184,5 +192,5 @@ }

// Apply data- and aria- attributes passed as props
for (var _key2 in props) {
if (/^(data-|aria-)/.test(_key2)) {
dialogProps[_key2] = props[_key2];
for (var _key3 in props) {
if (/^(data-|aria-)/.test(_key3)) {
dialogProps[_key3] = props[_key3];
}

@@ -199,5 +207,3 @@ }

focusTrapOptions: {
initialFocus: props.focusDialog ? '#react-aria-modal-dialog' : props.initialFocus,
escapeDeactivates: props.escapeExits,
onDeactivate: this.deactivate
initialFocus: props.focusDialog ? '#react-aria-modal-dialog' : props.initialFocus
},

@@ -204,0 +210,0 @@ paused: props.focusTrapPaused

{
"name": "react-aria-modal",
"version": "2.7.0",
"version": "2.7.1",
"description": "A fully accessible and flexible React modal built according WAI-ARIA Authoring Practices",

@@ -5,0 +5,0 @@ "main": "dist/react-aria-modal.js",

@@ -16,9 +16,2 @@ const React = require('react');

constructor(props) {
super(props);
this.checkClick = this.checkClick.bind(this);
this.deactivate = this.deactivate.bind(this);
}
componentWillMount() {

@@ -38,2 +31,3 @@ if (!this.props.titleText && !this.props.titleId) {

}
// Timeout to ensure this happens *after* focus has moved

@@ -46,2 +40,6 @@ const applicationNode = this.getApplicationNode();

}, 0);
if (props.escapeExits) {
document.addEventListener('keydown', this.checkDocumentKeyDown);
}
}

@@ -55,2 +53,3 @@

}
document.removeEventListener('keydown', this.checkDocumentKeyDown);
}

@@ -63,8 +62,14 @@

checkClick = event => {
checkUnderlayClick = event => {
if (this.dialogNode && this.dialogNode.contains(event.target)) return;
this.deactivate();
this.exit();
};
deactivate = () => {
checkDocumentKeyDown = event => {
if (event.key === 'Escape' || event.key === 'Esc' || event.keyCode === 27) {
this.exit();
}
}
exit = () => {
this.props.onExit();

@@ -113,3 +118,3 @@ };

if (props.underlayClickExits) {
underlayProps.onClick = this.checkClick;
underlayProps.onClick = this.checkUnderlayClick;
}

@@ -194,5 +199,3 @@

? '#react-aria-modal-dialog'
: props.initialFocus,
escapeDeactivates: props.escapeExits,
onDeactivate: this.deactivate
: props.initialFocus
},

@@ -199,0 +202,0 @@ paused: props.focusTrapPaused

Sorry, the diff of this file is not supported yet

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