Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions packages/web-pkg/src/components/SideBar/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,24 @@ const backgroundContentEl = computed(() => {
return unref(appSideBar)?.parentElement?.querySelector('div') as HTMLElement
})

const handleBackgroundContentVisibility = () => {
// handles the visibility of the content behind the sidebar. It needs to be hidden if
// the sidebar is open and has full width to avoid focusable elements.
if (!unref(backgroundContentEl)) {
return
}

const visibility = unref(fullWidthSideBar) ? 'hidden' : 'visible'
unref(backgroundContentEl).style.visibility = visibility
}

const onResize = () => {
if (!isOpen) {
return
}

windowWidth.value = window.innerWidth
handleBackgroundContentVisibility()
}

watch(
Expand All @@ -216,10 +228,7 @@ watch(
return
}
await nextTick()
if (unref(fullWidthSideBar) && unref(backgroundContentEl)) {
// hide content behind sidebar when it has full width to avoid focusable elements
unref(backgroundContentEl).style.visibility = 'hidden'
}
handleBackgroundContentVisibility()
},
{ immediate: true }
)
Expand Down