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

react-useportal

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-useportal - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

5

dist/usePortal.js

@@ -66,3 +66,2 @@ "use strict";

throw Error(errorMessage1);
const { left, top } = targetEl.current.getBoundingClientRect();
if (onOpen)

@@ -80,3 +79,3 @@ handleEvent(onOpen, event);

}, [isServer, handleEvent, onClose, setOpen]);
const togglePortal = react_1.useCallback((e) => isOpen ? closePortal(e) : openPortal(e), [isOpen, closePortal, openPortal]);
const togglePortal = react_1.useCallback((e) => open.current ? closePortal(e) : openPortal(e), [closePortal, openPortal]);
const handleKeydown = react_1.useCallback(e => {

@@ -92,3 +91,3 @@ var ESC = 27;

return;
if (portal.current.contains(e.target) || e.button !== 0 || !open.current)
if (portal.current.contains(e.target) || e.button !== 0 || !open.current || targetEl.current.contains(e.target))
return;

@@ -95,0 +94,0 @@ if (closeOnOutsideClick)

2

package.json
{
"name": "react-useportal",
"version": "1.0.2",
"version": "1.0.3",
"homepage": "https://codesandbox.io/s/w6jp7z4pkk",

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

@@ -86,6 +86,8 @@ <p style="text-align: center;" align="center">

const App = () => {
const { Portal } = usePortal()
const { Portal } = usePortal({
bindTo: document && document.getElementById('san-francisco')
})
return (
<Portal bindTo={document && document.getElementById('san-francisco')}>
<Portal>
This text is portaled into San Francisco!

@@ -92,0 +94,0 @@ </Portal>

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