Fixed scrolling of alternate tabs implementation

This commit is contained in:
squidfunk
2021-10-11 10:32:24 +02:00
parent 4618d04139
commit 7f38cfeb0f
8 changed files with 16 additions and 11 deletions

View File

@@ -52,7 +52,7 @@ export interface ContentTabs {
export function watchContentTabs(
el: HTMLElement
): Observable<ContentTabs> {
if (!el.classList.contains(".tabbed-alternate"))
if (!el.classList.contains("tabbed-alternate"))
return NEVER
else
return merge(...getElements(":scope > input", el)
@@ -77,7 +77,11 @@ export function mountContentTabs(
): Observable<Component<ContentTabs>> {
const internal$ = new Subject<ContentTabs>()
internal$.subscribe(({ active }) => {
active.scrollIntoView({ behavior: "smooth", block: "nearest" })
active.scrollIntoView({
behavior: "smooth",
block: "nearest",
inline: "start"
})
})
/* Create and return component */

View File

@@ -176,6 +176,7 @@
// Tab label
> label {
z-index: 1;
flex-shrink: 0;
width: auto;
padding: px2em(12px, 12.8px) 1.25em px2em(10px, 12.8px);
color: var(--md-default-fg-color--light);