Gathering detailed insights and metrics for aria-hidden
Gathering detailed insights and metrics for aria-hidden
Gathering detailed insights and metrics for aria-hidden
Gathering detailed insights and metrics for aria-hidden
npm install aria-hidden
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
50 Stars
46 Commits
6 Forks
3 Watching
3 Branches
5 Contributors
Updated on 08 Nov 2024
Minified
Minified + Gzipped
TypeScript (88.55%)
JavaScript (11.14%)
Shell (0.31%)
Cumulative downloads
Total Downloads
Last day
-5.6%
1,115,918
Compared to previous day
Last week
3.6%
6,291,679
Compared to previous week
Last month
8.1%
26,256,276
Compared to previous month
Last year
148.2%
273,893,831
Compared to previous year
1
2
Hides from ARIA everything, except provided node(s).
Helps to isolate modal dialogs and focused task - the content will be not accessible using accessible tools.
Now with HTML inert support
Just call hideOthers
with DOM-node you want to keep, and it will hide everything else.
targetNode
could be placed anywhere - its siblings would be hidden, but it and its parents - not.
"hidden" in terms or
aria-hidden
1import { hideOthers } from 'aria-hidden'; 2 3const undo = hideOthers(exceptThisDOMnode); 4// everything else is "aria-hidden" 5 6// undo changes 7undo();
you also may limit the effect spread by providing top level node as a second parameter
1// keep only `anotherNode` node visible in #app
2// the rest of document will be untouched
3hideOthers(anotherNode, document.getElementById('app'));
parentNode
defaults to document.body
While aria-hidden
played important role in the past and will play in the future - the main
use case always was around isolating content and making elements "transparent" not only for aria, but for
user interaction as well.
This is why you might consider using inertOthers
1import { hideOthers, inertOthers, supportsInert } from 'aria-hidden'; 2 3// focus on element mean "hide others". Ideally disable interactions 4const focusOnElement = (node) => (supportsInert() ? inertOthers(node) : hideOthers(node));
the same function as above is already contructed and exported as
1import { suppressOthers } from 'aria-hidden'; 2 3suppressOthers([keepThisNode, andThis]);
⚠️ Note - inert will disable any interactions with suppressed elements ⚠️
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
1[hidden-node] { 2 pointer-events: none; 3}
1hideOthers(notThisOne, undefined /*parent = document*/, 'hidden-node');
Generally speaking the same can be achieved by addressing [aria-hidden]
nodes, but
not all aria-hidden
nodes are expected to be non-interactive.
Hence, it's better to separate concerns.
Based on smooth-ui modal dialogs.
Code is 30 lines long
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 2/23 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
49 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More