1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-08 20:50:28 +00:00
Files
browser/libs/components/src/layout/layout.component.ts
Will Martin a0429d7d09 [CL-622][CL-562][CL-621][CL-632] various drawer improvements (#14120)
- add focus trap to drawers
- add config to open existing dialogs as drawers
- make drawer take up fill width/height on smaller screens
2025-05-15 10:32:52 -04:00

36 lines
1.0 KiB
TypeScript

import { A11yModule, CdkTrapFocus } from "@angular/cdk/a11y";
import { PortalModule } from "@angular/cdk/portal";
import { CommonModule } from "@angular/common";
import { Component, ElementRef, inject, viewChild } from "@angular/core";
import { RouterModule } from "@angular/router";
import { DrawerService } from "../drawer/drawer.service";
import { LinkModule } from "../link";
import { SideNavService } from "../navigation/side-nav.service";
import { SharedModule } from "../shared";
@Component({
selector: "bit-layout",
templateUrl: "layout.component.html",
standalone: true,
imports: [
CommonModule,
SharedModule,
LinkModule,
RouterModule,
PortalModule,
A11yModule,
CdkTrapFocus,
],
})
export class LayoutComponent {
protected sideNavService = inject(SideNavService);
protected drawerPortal = inject(DrawerService).portal;
private mainContent = viewChild.required<ElementRef<HTMLElement>>("main");
protected focusMainContent() {
this.mainContent().nativeElement.focus();
}
}