Skip to content

Commit

Permalink
chore: small changes (#6800)
Browse files Browse the repository at this point in the history
  • Loading branch information
waterplea authored Feb 15, 2024
1 parent ab0aba6 commit 069a650
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
7 changes: 4 additions & 3 deletions projects/core/components/scrollbar/scrollbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ import {TUI_SCROLL_INTO_VIEW, TUI_SCROLLABLE} from '@taiga-ui/core/constants';
],
})
export class TuiScrollbarComponent {
private delegated = false;

private readonly isLegacy: boolean =
!this.cssRef.supports('position', 'sticky') ||
(tuiIsFirefox(this.userAgent) &&
Expand All @@ -54,6 +52,10 @@ export class TuiScrollbarComponent {
@Inject(TUI_IS_IOS) private readonly isIos: boolean,
) {}

get delegated(): boolean {
return this.browserScrollRef.nativeElement !== this.el.nativeElement;
}

get showScrollbars(): boolean {
return !this.hidden && !this.isIos && (!this.isLegacy || this.delegated);
}
Expand All @@ -65,7 +67,6 @@ export class TuiScrollbarComponent {

@HostListener(`${TUI_SCROLLABLE}.stop`, ['$event.detail'])
onScrollable(element: HTMLElement): void {
this.delegated = true;
this.browserScrollRef.nativeElement = element;
}

Expand Down
4 changes: 4 additions & 0 deletions projects/core/components/scrollbar/scrollbar.style.less
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
flex-basis: auto;
width: 100%;
height: max-content;

&_delegated {
height: 100%;
}
}

.t-bars {
Expand Down
5 changes: 4 additions & 1 deletion projects/core/components/scrollbar/scrollbar.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
*ngIf="showScrollbars"
class="t-bars"
></tui-scroll-controls>
<div class="t-content">
<div
class="t-content"
[class.t-content_delegated]="delegated"
>
<ng-content></ng-content>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@
padding: 0;
font-size: 0;
}

:host-context([tuiIconButton]) {
position: absolute;
right: 25%;
top: 25%;
}
}
2 changes: 1 addition & 1 deletion projects/i18n/languages/english/kit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const TUI_ENGLISH_LANGUAGE_KIT: TuiLanguageKit = {
defaultLabelMultiple: 'or drop\u00A0them\u00A0here',
defaultLinkSingle: 'Choose a file',
defaultLinkMultiple: 'Choose files',
maxSizeRejectionReason: 'File is too large ',
maxSizeRejectionReason: 'File is larger than ',
formatRejectionReason: 'Wrong file type',
drop: 'Drop file here',
dropMultiple: 'Drop files here',
Expand Down

0 comments on commit 069a650

Please sign in to comment.