Fixed buggy content tabs overflow scrolling + updated documentation

This commit is contained in:
squidfunk
2021-10-11 14:14:04 +02:00
parent c4cf616670
commit 6fab1e3654
8 changed files with 325 additions and 321 deletions

View File

@@ -77,11 +77,16 @@ export function mountContentTabs(
): Observable<Component<ContentTabs>> {
const internal$ = new Subject<ContentTabs>()
internal$.subscribe(({ active }) => {
active.scrollIntoView({
behavior: "smooth",
block: "nearest",
inline: "start"
})
// TODO: Hack, scrollIntoView is too buggy
const container = active.parentElement!
if (
active.offsetLeft + active.offsetWidth > container.offsetWidth ||
active.offsetLeft < container.scrollLeft
)
container.scrollTo({
behavior: "smooth",
left: active.offsetLeft
})
})
/* Create and return component */