Skip to content

Commit 4722d05

Browse files
committed
fix: Toc trigger shrinks outside page when toggling off
1 parent 36269a5 commit 4722d05

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

toc-bar.user.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,15 @@ a.toc-link {
542542
} else {
543543
this.element.classList.add(HIDDEN_CLASS)
544544
this.logoSvg && this.logoSvg.classList.add(LOGO_HIDDEN_CLASS)
545+
546+
const right = parseInt(this.element.style.right)
547+
if (right && right < 0) {
548+
this.element.style.right = "0px"
549+
const cachedPosition = POSITION_STORAGE.cache
550+
if (!isEmpty(cachedPosition)) {
551+
POSITION_STORAGE.set(null, {...cachedPosition, right: 0 })
552+
}
553+
}
545554
}
546555
this.visible = shouldShow
547556
},

0 commit comments

Comments
 (0)