Skip to content

Commit

Permalink
fix: issue #8292 MessageBox error focus
Browse files Browse the repository at this point in the history
  • Loading branch information
LinZhanMing committed Jun 17, 2022
1 parent 4ac10cf commit 8d8821d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/components/message-box/src/index.vue
Expand Up @@ -126,7 +126,7 @@
{{ cancelButtonText || t('el.messagebox.cancel') }}
</el-button>
<el-button
v-show="showConfirmButton"
v-if="showConfirmButton"
ref="confirmRef"
type="primary"
:loading="confirmButtonLoading"
Expand Down Expand Up @@ -335,8 +335,14 @@ export default defineComponent({
() => visible.value,
(val) => {
if (val) {
if (props.boxType === 'alert' || props.boxType === 'confirm') {
focusStartRef.value = confirmRef.value?.$el ?? rootRef.value
if (
props.boxType === '' ||
props.boxType === 'alert' ||
props.boxType === 'confirm'
) {
nextTick().then(() => {
focusStartRef.value = confirmRef.value?.$el ?? rootRef.value
})
}
state.zIndex = nextZIndex()
}
Expand Down

0 comments on commit 8d8821d

Please sign in to comment.