mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
fix(Modal/Slideover): don't emit close:prevent on closeAutoFocus
This commit is contained in:
@@ -104,15 +104,15 @@ const contentEvents = computed(() => {
|
||||
}
|
||||
|
||||
if (!props.dismissible) {
|
||||
const events = ['pointerDownOutside', 'interactOutside', 'escapeKeyDown', 'closeAutoFocus'] as const
|
||||
type EventType = typeof events[number]
|
||||
const events = ['pointerDownOutside', 'interactOutside', 'escapeKeyDown']
|
||||
|
||||
return events.reduce((acc, curr) => {
|
||||
acc[curr] = (e: Event) => {
|
||||
e.preventDefault()
|
||||
emits('close:prevent')
|
||||
}
|
||||
return acc
|
||||
}, {} as Record<EventType, (e: Event) => void>)
|
||||
}, defaultEvents as Record<typeof events[number] | keyof typeof defaultEvents, (e: Event) => void>)
|
||||
}
|
||||
|
||||
return defaultEvents
|
||||
|
||||
@@ -75,15 +75,15 @@ const portalProps = usePortal(toRef(() => props.portal))
|
||||
const contentProps = toRef(() => defu(props.content, { side: 'bottom', sideOffset: 8, collisionPadding: 8 }) as PopoverContentProps)
|
||||
const contentEvents = computed(() => {
|
||||
if (!props.dismissible) {
|
||||
const events = ['pointerDownOutside', 'interactOutside', 'escapeKeyDown'] as const
|
||||
type EventType = typeof events[number]
|
||||
const events = ['pointerDownOutside', 'interactOutside', 'escapeKeyDown']
|
||||
|
||||
return events.reduce((acc, curr) => {
|
||||
acc[curr] = (e: Event) => {
|
||||
e.preventDefault()
|
||||
emits('close:prevent')
|
||||
}
|
||||
return acc
|
||||
}, {} as Record<EventType, (e: Event) => void>)
|
||||
}, {} as Record<typeof events[number], (e: Event) => void>)
|
||||
}
|
||||
|
||||
return {}
|
||||
|
||||
@@ -103,16 +103,17 @@ const contentEvents = computed(() => {
|
||||
const defaultEvents = {
|
||||
closeAutoFocus: (e: Event) => e.preventDefault()
|
||||
}
|
||||
|
||||
if (!props.dismissible) {
|
||||
const events = ['pointerDownOutside', 'interactOutside', 'escapeKeyDown', 'closeAutoFocus'] as const
|
||||
type EventType = typeof events[number]
|
||||
const events = ['pointerDownOutside', 'interactOutside', 'escapeKeyDown']
|
||||
|
||||
return events.reduce((acc, curr) => {
|
||||
acc[curr] = (e: Event) => {
|
||||
e.preventDefault()
|
||||
emits('close:prevent')
|
||||
}
|
||||
return acc
|
||||
}, {} as Record<EventType, (e: Event) => void>)
|
||||
}, defaultEvents as Record<typeof events[number] | keyof typeof defaultEvents, (e: Event) => void>)
|
||||
}
|
||||
|
||||
return defaultEvents
|
||||
|
||||
Reference in New Issue
Block a user