mirror of
https://github.com/element-plus/element-plus.git
synced 2025-02-17 11:49:41 +08:00
fix(components): [dialog] click allow focus out (#10160)
Co-authored-by: OpenGraphica <opengraphica@gmail.com>
This commit is contained in:
parent
c7b8cf7e54
commit
715384bf4e
@ -31,6 +31,7 @@
|
||||
focus-start-el="container"
|
||||
@focus-after-trapped="onOpenAutoFocus"
|
||||
@focus-after-released="onCloseAutoFocus"
|
||||
@focusout-prevented="onFocusoutPrevented"
|
||||
@release-requested="onCloseRequested"
|
||||
>
|
||||
<el-dialog-content
|
||||
@ -132,6 +133,7 @@ const {
|
||||
onOpenAutoFocus,
|
||||
onCloseAutoFocus,
|
||||
onCloseRequested,
|
||||
onFocusoutPrevented,
|
||||
} = useDialog(props, dialogRef)
|
||||
|
||||
provide(dialogInjectionKey, {
|
||||
|
@ -138,6 +138,12 @@ export const useDialog = (
|
||||
emit('closeAutoFocus')
|
||||
}
|
||||
|
||||
function onFocusoutPrevented(event: CustomEvent) {
|
||||
if (event.detail?.focusReason === 'pointer') {
|
||||
event.preventDefault()
|
||||
}
|
||||
}
|
||||
|
||||
if (props.lockScroll) {
|
||||
useLockscreen(visible)
|
||||
}
|
||||
@ -204,6 +210,7 @@ export const useDialog = (
|
||||
onOpenAutoFocus,
|
||||
onCloseAutoFocus,
|
||||
onCloseRequested,
|
||||
onFocusoutPrevented,
|
||||
titleId,
|
||||
bodyId,
|
||||
closed,
|
||||
|
Loading…
Reference in New Issue
Block a user