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

aria-hidden

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aria-hidden - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

18

dist/es2015/index.js

@@ -12,2 +12,18 @@ var getDefaultParent = function (originalTarget) {

var lockCount = 0;
var unwrapHost = function (node) {
return node && (node.host || unwrapHost(node.parentNode));
};
var correctTargets = function (parent, targets) {
return targets.map(function (target) {
if (parent.contains(target)) {
return target;
}
var correctedTarget = unwrapHost(target);
if (correctedTarget && parent.contains(correctedTarget)) {
return correctedTarget;
}
console.error('aria-hidden', target, 'in not contained inside', parent, '. Doing nothing');
return null;
}).filter(function (x) { return Boolean(x); });
};
/**

@@ -22,3 +38,3 @@ * Marks everything except given node(or nodes) as aria-hidden

var applyAttributeToOthers = function (originalTarget, parentNode, markerName, controlAttribute) {
var targets = Array.isArray(originalTarget) ? originalTarget : [originalTarget];
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
if (!markerMap[markerName]) {

@@ -25,0 +41,0 @@ markerMap[markerName] = new WeakMap();

@@ -12,2 +12,14 @@ const getDefaultParent = (originalTarget) => {

let lockCount = 0;
const unwrapHost = (node) => node && (node.host || unwrapHost(node.parentNode));
const correctTargets = (parent, targets) => targets.map(target => {
if (parent.contains(target)) {
return target;
}
const correctedTarget = unwrapHost(target);
if (correctedTarget && parent.contains(correctedTarget)) {
return correctedTarget;
}
console.error('aria-hidden', target, 'in not contained inside', parent, '. Doing nothing');
return null;
}).filter((x) => Boolean(x));
/**

@@ -22,3 +34,3 @@ * Marks everything except given node(or nodes) as aria-hidden

const applyAttributeToOthers = (originalTarget, parentNode, markerName, controlAttribute) => {
const targets = Array.isArray(originalTarget) ? originalTarget : [originalTarget];
const targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
if (!markerMap[markerName]) {

@@ -25,0 +37,0 @@ markerMap[markerName] = new WeakMap();

@@ -15,2 +15,18 @@ "use strict";

var lockCount = 0;
var unwrapHost = function (node) {
return node && (node.host || unwrapHost(node.parentNode));
};
var correctTargets = function (parent, targets) {
return targets.map(function (target) {
if (parent.contains(target)) {
return target;
}
var correctedTarget = unwrapHost(target);
if (correctedTarget && parent.contains(correctedTarget)) {
return correctedTarget;
}
console.error('aria-hidden', target, 'in not contained inside', parent, '. Doing nothing');
return null;
}).filter(function (x) { return Boolean(x); });
};
/**

@@ -25,3 +41,3 @@ * Marks everything except given node(or nodes) as aria-hidden

var applyAttributeToOthers = function (originalTarget, parentNode, markerName, controlAttribute) {
var targets = Array.isArray(originalTarget) ? originalTarget : [originalTarget];
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
if (!markerMap[markerName]) {

@@ -28,0 +44,0 @@ markerMap[markerName] = new WeakMap();

2

package.json
{
"name": "aria-hidden",
"version": "1.2.1",
"version": "1.2.2",
"description": "Cast aria-hidden to everything, except...",

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

@@ -62,2 +62,23 @@ # aria-hidden

⚠️ Note - inert **will disable any interactions** with _suppressed_ elements ⚠️
### Suppressing interactivity without inert
One can `marker`, the third argument to a function, to mark hidden elements.
Later one can create a style matching given marker to apply `pointer-events:none`
```css
[hidden-node] {
pointer-events: none;
}
```
```tsx
hideOthers(notThisOne, undefined /*parent = document*/, 'hidden-node');
```
Generally speaking the same can be archived by addressing `[aria-hidden]` nodes, but
not all `aria-hidden` nodes are expected to be non-interactive.
Hence, it's better to separate concerns.
# Inspiration

@@ -64,0 +85,0 @@

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