Commit 1cda9914 authored by Michael Iseard's avatar Michael Iseard
Browse files

Minor formatting changes

parent d6ec3053
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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment