Skip to content

Commit

Permalink
chore: move input autofocus to renderInput() (#1679)
Browse files Browse the repository at this point in the history
  • Loading branch information
limonte committed Jul 20, 2019
1 parent 1cdb9a0 commit c24490b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/instanceMethods/_main.js
Expand Up @@ -67,16 +67,6 @@ const swalPromise = (instance, domCache, innerParams) => {
}, innerParams.timer)
}

// input autofocus
if (innerParams.input) {
setTimeout(() => {
const input = instance.getInput()
if (input) {
dom.focusInput(input)
}
}, 0)
}

// Click 'confirm' button
domCache.confirmButton.onclick = () => {
handleConfirmButtonClick(instance, innerParams)
Expand Down
5 changes: 5 additions & 0 deletions src/utils/dom/renderers/renderInput.js
Expand Up @@ -37,6 +37,11 @@ const showInput = (params) => {

const input = renderInputType[params.input](params)
dom.show(input)

// input autofocus
setTimeout(() => {
dom.focusInput(input)
}, 0)
}

const removeAttributes = (input) => {
Expand Down

0 comments on commit c24490b

Please sign in to comment.