mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-18 10:59:10 +08:00
fix(components): [focus-trap] respect focusout null relatedTarget (#7915)
* fix(components): [focus-trap] respect focusout null relatedTarget * fix(components): [focus-trap] use right variable this time Co-authored-by: OpenGraphica <opengraphica@gmail.com>
This commit is contained in:
parent
49ed2f6907
commit
b6049dab1c
@ -12,6 +12,7 @@ import {
|
||||
unref,
|
||||
watch,
|
||||
} from 'vue'
|
||||
import { isNil } from 'lodash-unified'
|
||||
import { EVENT_CODE } from '@element-plus/constants'
|
||||
import { useEscapeKeydown } from '@element-plus/hooks'
|
||||
import { isString } from '@element-plus/utils'
|
||||
@ -168,11 +169,9 @@ export default defineComponent({
|
||||
if (focusLayer.paused || !trapContainer) return
|
||||
|
||||
if (props.trapped) {
|
||||
if (
|
||||
!trapContainer.contains(
|
||||
(e as FocusEvent).relatedTarget as HTMLElement | null
|
||||
)
|
||||
) {
|
||||
const relatedTarget = (e as FocusEvent)
|
||||
.relatedTarget as HTMLElement | null
|
||||
if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
|
||||
tryFocus(lastFocusAfterTrapped, true)
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user