Skip to content

Commit

Permalink
fix(MenuSubContent): content was overflow out of viewport (#645)
Browse files Browse the repository at this point in the history
* fix: all subcontent should prioritzie position for smaller viewport

* fix: position flip depends on the prioritzePosition prop

* chore: lint
  • Loading branch information
zernonia committed Jan 31, 2024
1 parent 912562a commit ea6fb26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/radix-vue/src/Menu/MenuSubContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import { SUB_CLOSE_KEYS } from './utils'
import { Presence } from '@/Presence'
import { useForwardExpose, useForwardPropsEmits } from '@/shared'
const props = defineProps<MenuSubContentProps>()
const props = withDefaults(defineProps<MenuSubContentProps>(), {
prioritizePosition: true,
})
const emits = defineEmits<MenuSubContentEmits>()
const forwarded = useForwardPropsEmits(props, emits)
Expand Down
5 changes: 5 additions & 0 deletions packages/radix-vue/src/Popper/PopperContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ const computedMiddleware = computedEager(() => {
mainAxis: props.sideOffset + arrowHeight.value,
alignmentAxis: props.alignOffset,
}),
props.prioritizePosition
&& props.avoidCollisions
&& flip({
...detectOverflowOptions.value,
}),
props.avoidCollisions
&& shift({
mainAxis: true,
Expand Down

0 comments on commit ea6fb26

Please sign in to comment.