Skip to content

Commit d1c8765

Browse files
authored
feat(igx-vhelper): create and use css var for scrollbar size (#15863)
1 parent 540a3ec commit d1c8765

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

projects/igniteui-angular/src/lib/core/styles/components/_common/_igx-vhelper.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
position: absolute;
1313
top: 0;
1414
inset-inline-end: 0;
15+
width: var(--vhelper-scrollbar-size);
1516
}
1617

1718
%vhelper--horizontal {

projects/igniteui-angular/src/lib/core/styles/components/drop-down/_drop-down-theme.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@
242242
overflow-x: hidden;
243243
-webkit-overflow-scrolling: touch;
244244
position: relative;
245+
246+
igx-display-container {
247+
padding-inline-end: var(--vhelper-scrollbar-size);
248+
}
245249
}
246250

247251
%igx-drop-down__content {

projects/igniteui-angular/src/lib/core/styles/themes/_core.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@
124124
inherits: true;
125125
}
126126

127+
@property --vhelper-scollbar-size {
128+
syntax: '<length>';
129+
initial-value: 16px;
130+
inherits: true;
131+
}
132+
127133
// Component styles
128134
@include ripple.component();
129135
@include action-strip.component();

projects/igniteui-angular/src/lib/directives/for-of/virtual.helper.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ export class VirtualHelperComponent extends VirtualHelperBaseDirective implement
1313
@HostBinding('scrollTop')
1414
public scrollTop;
1515

16-
@HostBinding('style.width.px')
1716
public scrollWidth;
1817

1918
@ViewChild('container', { read: ViewContainerRef, static: true }) public _vcr;
2019
@Input() public itemsLength: number;
2120

22-
2321
@HostBinding('class')
2422
public cssClasses = 'igx-vhelper--vertical';
2523

@@ -29,6 +27,10 @@ export class VirtualHelperComponent extends VirtualHelperBaseDirective implement
2927

3028
public ngOnInit() {
3129
this.scrollWidth = this.scrollNativeSize;
30+
this.document.documentElement.style.setProperty(
31+
'--vhelper-scrollbar-size',
32+
`${this.scrollNativeSize}px`
33+
);
3234
}
3335

3436
protected override restoreScroll() {

0 commit comments

Comments
 (0)