Skip to content

Commit ea6fb26

Browse files
authored
fix(MenuSubContent): content was overflow out of viewport (#645)
* fix: all subcontent should prioritzie position for smaller viewport * fix: position flip depends on the prioritzePosition prop * chore: lint
1 parent 912562a commit ea6fb26

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/radix-vue/src/Menu/MenuSubContent.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ import { SUB_CLOSE_KEYS } from './utils'
2424
import { Presence } from '@/Presence'
2525
import { useForwardExpose, useForwardPropsEmits } from '@/shared'
2626
27-
const props = defineProps<MenuSubContentProps>()
27+
const props = withDefaults(defineProps<MenuSubContentProps>(), {
28+
prioritizePosition: true,
29+
})
2830
const emits = defineEmits<MenuSubContentEmits>()
2931
3032
const forwarded = useForwardPropsEmits(props, emits)

packages/radix-vue/src/Popper/PopperContent.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ const computedMiddleware = computedEager(() => {
212212
mainAxis: props.sideOffset + arrowHeight.value,
213213
alignmentAxis: props.alignOffset,
214214
}),
215+
props.prioritizePosition
216+
&& props.avoidCollisions
217+
&& flip({
218+
...detectOverflowOptions.value,
219+
}),
215220
props.avoidCollisions
216221
&& shift({
217222
mainAxis: true,

0 commit comments

Comments
 (0)