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

focus-trap

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

focus-trap - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

20

index.js

@@ -23,11 +23,19 @@ var tabbable = require('tabbable');

var focusNode = (function() {
if (!config.initialFocus) return tabbableNodes[0];
var node;
if (!config.initialFocus) {
node = tabbableNodes[0];
if (!node) {
throw new Error('You can\'t have a focus-trap without at least one focusable element');
}
}
if (typeof config.initialFocus === 'string') {
return document.querySelector(config.initialFocus);
node = document.querySelector(config.initialFocus);
} else {
node = config.initialFocus;
}
return config.initialFocus;
if (!node) {
throw new Error('The `initialFocus` selector you passed refers to no known node');
}
return node;
}());
if (!focusNode) {
throw new Error('You can\'t have a focus-trap without at least one focusable element');
}
focusNode.focus();

@@ -34,0 +42,0 @@

{
"name": "focus-trap",
"version": "0.3.0",
"version": "0.3.1",
"description": "Trap focus within a DOM node.",

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

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