Skip to content

Commit f5e5799

Browse files
committed
Focus hard confirm verification input on dialog open. Disabled auto-complete.
1 parent 0568eb1 commit f5e5799

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

dist/vuejs-dialog.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vuejs-dialog.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/vuejs-dialog.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/plugin/components/dialog-window.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@
1313
<div v-if="options.html" class="dg-content" v-html="options.message"></div>
1414
<div v-else="" class="dg-content">{{ options.message }}</div>
1515

16-
<form v-if="isHardConfirm || isPrompt" class="dg-form" @submit.prevent="submitDialogForm">
17-
<label for="dg-input-label" style="font-size: 13px">{{ hardConfirmHelpText }}</label>
16+
<form v-if="isHardConfirm || isPrompt"
17+
class="dg-form"
18+
autocomplete="off"
19+
@submit.prevent="submitDialogForm">
20+
<label for="dg-input-elem" style="font-size: 13px">{{ hardConfirmHelpText }}</label>
1821
<input type="text" :placeholder="options.verification"
1922
v-model="input"
20-
id="dg-input-label"
23+
autocomplete="off"
24+
id="dg-input-elem"
25+
ref="inputElem"
2126
style="width: 100%;margin-top: 10px;
2227
padding: 5px 15px; font-size: 16px;border-radius: 4px; border: 2px solid #eee"/>
2328
</form>
@@ -116,10 +121,10 @@
116121
return (this.options.reverse === true) ? 'cancel-btn' : 'ok-btn'
117122
},
118123
leftBtnFocus(){
119-
return (this.options.reverse === true)
124+
return !this.isHardConfirm && (this.options.reverse === true)
120125
},
121126
rightBtnFocus(){
122-
return (this.options.reverse === false)
127+
return !this.isHardConfirm && (this.options.reverse === false)
123128
},
124129
leftBtnText(){
125130
return this.options.reverse ? this.options.okText : this.options.cancelText
@@ -134,6 +139,9 @@
134139
})
135140
}
136141
},
142+
mounted () {
143+
this.isHardConfirm && this.$refs.inputElem.focus()
144+
},
137145
methods: {
138146
clickRightBtn(){
139147
this.options.reverse ? this.cancel() : this.proceed()

0 commit comments

Comments
 (0)