kopia lustrzana https://github.com/shoelace-style/shoelace
add notes about browser support
rodzic
9e66fc8f2d
commit
35585cc204
|
@ -31,8 +31,8 @@ export function lockBodyScrolling(lockingEl: HTMLElement) {
|
||||||
// When the first lock is created, set the scroll lock size to match the scrollbar's width to prevent content from
|
// When the first lock is created, set the scroll lock size to match the scrollbar's width to prevent content from
|
||||||
// shifting. We only do this on the first lock because the scrollbar width will measure zero after overflow is hidden.
|
// shifting. We only do this on the first lock because the scrollbar width will measure zero after overflow is hidden.
|
||||||
if (!document.documentElement.classList.contains('sl-scroll-lock')) {
|
if (!document.documentElement.classList.contains('sl-scroll-lock')) {
|
||||||
|
/** Scrollbar width + body padding calculation can go away once Safari has scrollbar-gutter support. */
|
||||||
const scrollbarWidth = getScrollbarWidth() + getExistingBodyPadding(); // must be measured before the `sl-scroll-lock` class is applied
|
const scrollbarWidth = getScrollbarWidth() + getExistingBodyPadding(); // must be measured before the `sl-scroll-lock` class is applied
|
||||||
|
|
||||||
document.documentElement.classList.add('sl-scroll-lock');
|
document.documentElement.classList.add('sl-scroll-lock');
|
||||||
document.documentElement.style.setProperty('--sl-scroll-lock-size', `${scrollbarWidth}px`);
|
document.documentElement.style.setProperty('--sl-scroll-lock-size', `${scrollbarWidth}px`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** This can go away once Safari has scrollbar-gutter support. */
|
||||||
@supports not (scrollbar-gutter: stable) {
|
@supports not (scrollbar-gutter: stable) {
|
||||||
.sl-scroll-lock body {
|
.sl-scroll-lock body {
|
||||||
padding-right: var(--sl-scroll-lock-size) !important;
|
padding-right: var(--sl-scroll-lock-size) !important;
|
||||||
|
|
Ładowanie…
Reference in New Issue