Skip to content

Commit

Permalink
Add css rules for .ag-body-horizontal-scroll.ag-scrollbar-invisible
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhwhite committed Sep 26, 2022
1 parent 9a880a8 commit e0ca4cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,19 @@ export class SkyAgGridWrapperComponent implements AfterContentInit, OnDestroy {
'.ag-body-horizontal-scroll'
);
if (header && floatingBottom && scrollbar) {
if (
scrollbar.style.height !==
scrollbar.style.getPropertyValue(
'--sky-ag-body-horizontal-scroll-width'
)
) {
scrollbar.style.setProperty(
'--sky-ag-body-horizontal-scroll-width',
scrollbar.style.height
);
}
const isTop = !!root.children[1].matches('.ag-body-horizontal-scroll');
if (toTop && !isTop) {
// AG Grid detects whether the scrollbar takes up space, but we want to leave space for it regardless.
scrollbar.classList.remove('ag-scrollbar-invisible');
const fragment = this.document.createDocumentFragment();
fragment.appendChild(scrollbar);
header.after(fragment);
Expand Down
9 changes: 9 additions & 0 deletions libs/components/ag-grid/src/lib/styles/ag-grid-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,22 @@ $sky-cell-wrap-text-line-height-modern: $sky-theme-modern-font-paragraph-line-he
.sky-ag-grid.sky-ag-grid-top-scrollbar .ag-root {
> .ag-body-viewport {
.ag-center-cols-viewport {
/* Prevent a double scrollbar. */
scrollbar-width: none;

&::-webkit-scrollbar {
display: none;
}
}
}
.ag-body-horizontal-scroll.ag-scrollbar-invisible {
/* Value is overridden in SkyAgGridWrapperComponent to match the calculated value AG Grid uses. */
--sky-ag-body-horizontal-scroll-width: 15px;
position: relative;
z-index: 1;
bottom: revert;
margin-bottom: calc(var(--sky-ag-body-horizontal-scroll-width) * -1);
}
}

ag-grid-angular:not(.sky-ag-grid-editable) {
Expand Down

0 comments on commit e0ca4cc

Please sign in to comment.