mirror of
https://github.com/bitwarden/browser
synced 2026-02-09 13:10:17 +00:00
fix bugs
This commit is contained in:
@@ -57,7 +57,7 @@ export class A11yGridDirective {
|
||||
);
|
||||
private numColumns = computed(() => this.renderedRow().length);
|
||||
|
||||
private focusTarget = computed(() => this.renderedRow()?.[this.activeCol()]?.getFocusTarget());
|
||||
focusTarget = computed(() => this.renderedRow()?.[this.activeCol()]?.getFocusTarget());
|
||||
|
||||
constructor() {
|
||||
// init the grid
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
ElementRef,
|
||||
HostBinding,
|
||||
HostListener,
|
||||
effect,
|
||||
inject,
|
||||
signal,
|
||||
} from "@angular/core";
|
||||
|
||||
import { A11yGridDirective } from "../a11y/a11y-grid.directive";
|
||||
import { A11yRowDirective } from "../a11y/a11y-row.directive";
|
||||
|
||||
import { ItemActionComponent } from "./item-action.component";
|
||||
@@ -36,6 +40,23 @@ export class ItemComponent extends A11yRowDirective {
|
||||
this.focusVisibleWithin.set(false);
|
||||
}
|
||||
|
||||
private a11yGrid = inject(A11yGridDirective);
|
||||
private el = inject(ElementRef<HTMLElement>);
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
/** Workaround to reset internal component state when view is recycled during virtual scroll */
|
||||
effect(
|
||||
() => {
|
||||
if (!this.el.nativeElement.contains(this.a11yGrid.focusTarget())) {
|
||||
this.focusVisibleWithin.set(false);
|
||||
}
|
||||
},
|
||||
{ allowSignalWrites: true },
|
||||
);
|
||||
}
|
||||
|
||||
@HostBinding("class") get classList(): string[] {
|
||||
return [
|
||||
this.focusVisibleWithin()
|
||||
|
||||
Reference in New Issue
Block a user