Skip to content

Commit

Permalink
Merge pull request #7529 from owncloud/fix-left-sidebar-on-app-switch
Browse files Browse the repository at this point in the history
Fix glitchy left sidebar when switching apps
  • Loading branch information
JammingBen authored Aug 26, 2022
2 parents a1e9ec1 + f00796e commit b3548d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-left-sidebar-app-switch
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Left sidebar when switching apps

We've fixed a bug where the active state of the left sidebar would glitch visually when switching apps.

https://github.com/owncloud/web/issues/7526
https://github.com/owncloud/web/pull/7529
24 changes: 11 additions & 13 deletions packages/web-runtime/src/components/SidebarNav/SidebarNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,23 @@ export default {
}
},
mounted() {
const navItem = document.getElementsByClassName('oc-sidebar-nav-item-link')[0]
const navBar = document.getElementById('web-nav-sidebar')
const highlighter = document.getElementById('nav-highlighter')
if (!highlighter || !navItem) {
if (!highlighter || !navBar) {
return
}
const resizeObserver = new ResizeObserver((data) => {
const width = data[0].borderBoxSize[0].inlineSize
highlighter.style.setProperty('transition-duration', `0.05s`)
if (width) {
highlighter.style.setProperty('width', `${width}px`)
const resizeObserver = new ResizeObserver(() => {
const navItem = document.getElementsByClassName('oc-sidebar-nav-item-link')[0]
if (!navItem) {
return
}
})
resizeObserver.observe(navItem)
if (navItem.clientWidth) {
highlighter.style.setProperty('transition-duration', `0.05s`)
highlighter.style.setProperty('width', `${navItem.clientWidth}px`)
highlighter.style.setProperty('height', `${navItem.clientHeight}px`)
}
})
resizeObserver.observe(navBar)
this.$on('beforeDestroy', () => {
resizeObserver.disconnect()
Expand Down Expand Up @@ -149,7 +147,7 @@ export default {
max-width: 230px !important;
}
.oc-app-navigation-collapsed {
min-width: 58px !important;
max-width: 58px !important;
min-width: 62px !important;
max-width: 62px !important;
}
</style>

0 comments on commit b3548d5

Please sign in to comment.