Skip to content

Commit

Permalink
fix(NavigationMenu): content still showing after closing (unovue#750)
Browse files Browse the repository at this point in the history
* fix: content still showing after closing

* chore: add todo test
  • Loading branch information
zernonia authored Mar 11, 2024
1 parent 0c14fdc commit b009d09
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
12 changes: 12 additions & 0 deletions packages/radix-vue/src/NavigationMenu/NavigationMenu.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,17 @@ describe('given default NavigationMenu', () => {
expect(links[links.length - 1].element).toBe(document.activeElement)
})
})

// TODO: Better dismissable test
// describe('after interacting outside', () => {
// beforeEach(async () => {
// await fireEvent.pointerDown(document.body)
// await sleep(0)
// })

// it('should close the content', () => {
// expect(wrapper.find('[data-dismissable-layer]').exists()).toBe(false)
// })
// })
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ const open = computed(() => itemContext.value === menuContext.modelValue.value)
// We persist the last active content value as the viewport may be animating out
// and we want the content to remain mounted for the lifecycle of the viewport.
const isLastActiveValue = computed(() => {
if (!menuContext.modelValue.value && menuContext.previousValue.value)
return (menuContext.previousValue.value === itemContext.value)
if (menuContext.viewport.value) {
if (!menuContext.modelValue.value && menuContext.previousValue.value)
return (menuContext.previousValue.value === itemContext.value)
}
return false
})
</script>
Expand Down

0 comments on commit b009d09

Please sign in to comment.