Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix(breadcrumbs): Fixes an ExpressionChangedAfterChecked error on the…
Browse files Browse the repository at this point in the history
… breadcrumbs in non OnPush environments.
  • Loading branch information
ffriedl89 authored and tomheller committed Feb 9, 2021
1 parent fdb23e1 commit f8d173e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions libs/barista-components/breadcrumbs/src/breadcrumbs-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,25 @@ const BREADCRUMBS_ITEM_ELLIPSIS_CLASS = `dt-breadcrumbs-item-ellipsis`;
exportAs: 'dtBreadcrumbsItem',
host: {
class: 'dt-breadcrumbs-item',
'[class.dt-breadcrumbs-item-non-interactive]': '!_isFocusable',
'(keydown)': '_onKeyDown($event)',
},
})
export class DtBreadcrumbsItem2 implements Highlightable {
constructor(
readonly _elementRef: ElementRef<HTMLAnchorElement>,
private _interactivityChecker: InteractivityChecker,
) {}

/** @internal Whether the breadcrumb is focusable - determined by the interactivity checker */
get _isFocusable(): boolean {
return this._interactivityChecker.isFocusable(
this._elementRef.nativeElement,
);
}

/** @internal Stream of keydown events on the breadcrumb item */
_onKeyDown$ = new Subject<KeyboardEvent>();

constructor(
readonly _elementRef: ElementRef<HTMLAnchorElement>,
private _interactivityChecker: InteractivityChecker,
) {}

/** Applies the styles for an active item to this item. Part of the Highlightable interface */
setActiveStyles(): void {
if (this._isFocusable) {
Expand Down
2 changes: 1 addition & 1 deletion libs/barista-components/breadcrumbs/src/breadcrumbs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ $dt-breadcrumbs-panel-min-width: 112px !default;
outline: none;
}

&.dt-breadcrumbs-item-non-interactive {
&:not([href]) {
color: $disabledcolor;
background-color: inherit;
cursor: default;
Expand Down

0 comments on commit f8d173e

Please sign in to comment.