Skip to content

Commit

Permalink
fix: types in keydown-handler.js
Browse files Browse the repository at this point in the history
  • Loading branch information
limonte committed Nov 30, 2022
1 parent 3927058 commit 51f05b0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/SweetAlert.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ Object.assign(SweetAlert, staticMethods)
Object.keys(instanceMethods).forEach((key) => {
/**
* @param {...any} args
* @returns {any}
* @returns {any | undefined}
*/
SweetAlert[key] = function (...args) {
if (currentInstance) {
Expand Down
3 changes: 3 additions & 0 deletions src/instanceMethods/_destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import globalState from '../globalState.js'
import privateMethods from '../privateMethods.js'
import privateProps from '../privateProps.js'

/**
* Dispose the current SweetAlert2 instance
*/
export function _destroy() {
const domCache = privateProps.domCache.get(this)
const innerParams = privateProps.innerParams.get(this)
Expand Down
7 changes: 4 additions & 3 deletions src/keydown-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export const setFocus = (innerParams, index, increment) => {
index = focusableElements.length - 1
}

return focusableElements[index].focus()
focusableElements[index].focus()
return
}
// no visible focusable elements, focus the popup
dom.getPopup().focus()
Expand All @@ -68,7 +69,7 @@ const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp']
/**
* @param {SweetAlert2} instance
* @param {KeyboardEvent} e
* @param {function} dismissWith
* @param {Function} dismissWith
*/
const keydownHandler = (instance, e, dismissWith) => {
const innerParams = privateProps.innerParams.get(instance)
Expand Down Expand Up @@ -198,7 +199,7 @@ const handleArrows = (key) => {
/**
* @param {KeyboardEvent} e
* @param {SweetAlertOptions} innerParams
* @param {function} dismissWith
* @param {Function} dismissWith
*/
const handleEsc = (e, innerParams, dismissWith) => {
if (callIfFunction(innerParams.allowEscapeKey)) {
Expand Down

0 comments on commit 51f05b0

Please sign in to comment.