mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-07-30 17:46:21 -04:00
Fixed buggy content tabs overflow scrolling + updated documentation
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user