Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michael Iseard
Kudos-Donations
Commits
1cda9914
Commit
1cda9914
authored
Oct 12, 2021
by
Michael Iseard
Browse files
Minor formatting changes
parent
d6ec3053
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/public/KudosModal.js
View file @
1cda9914
class
KudosModal
{
constructor
(
modal
,
options
=
[])
{
this
.
isOpen
=
false
this
.
modal
=
document
.
getElementById
(
modal
)
this
.
closeModal
=
this
.
modal
.
querySelectorAll
(
'
[data-modal-close]
'
)
this
.
options
=
{
timeOut
:
options
.
timeOut
??
300
,
triggerElement
:
options
.
triggerElement
,
...
...
@@ -16,6 +13,9 @@ class KudosModal {
onClose
:
options
.
onClose
,
onClosed
:
options
.
onClosed
}
this
.
isOpen
=
false
this
.
modal
=
document
.
getElementById
(
modal
)
this
.
closeModal
=
this
.
modal
.
querySelectorAll
(
'
[data-modal-close]
'
)
this
.
focusableElements
=
[
'
a[href]
'
,
'
area[href]
'
,
...
...
@@ -149,11 +149,14 @@ class KudosModal {
const
firstFocusableElement
=
focusableContent
[
0
]
const
lastFocusableElement
=
focusableContent
[
focusableContent
.
length
-
1
]
// Check if using shift (reverse) and on first element
if
(
e
.
shiftKey
)
{
if
(
document
.
activeElement
===
firstFocusableElement
)
{
lastFocusableElement
.
focus
()
e
.
preventDefault
()
}
// Check if on last element
}
else
{
if
(
document
.
activeElement
===
lastFocusableElement
)
{
firstFocusableElement
.
focus
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment