forked from reactjs/react-modal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
keeping a reference of all modals in order to manage when to add/remove classes and aria from elements correctly.
- Loading branch information
1 parent
02a16ce
commit e579a0d
Showing
3 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const modals = []; | ||
|
||
export function add (element) { | ||
if (modals.indexOf(element) === -1) { | ||
modals.push(element); | ||
} | ||
} | ||
|
||
export function remove (element) { | ||
const index = modals.indexOf(element); | ||
if (index === -1) { | ||
return; | ||
} | ||
modals.splice(index, 1); | ||
} | ||
|
||
export function count () { | ||
return modals.length; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters