mirror of
https://github.com/bitwarden/browser
synced 2026-02-14 23:45:37 +00:00
[CL-237] Update menu styles for extension refresh (#9525)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<div
|
||||
class="tw-my-2 tw-border-0 tw-border-t tw-border-solid tw-border-t-secondary-600"
|
||||
class="tw-my-2 tw-border-0 tw-border-t tw-border-solid tw-border-t-secondary-500"
|
||||
role="separator"
|
||||
aria-hidden="true"
|
||||
></div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { FocusableOption } from "@angular/cdk/a11y";
|
||||
import { Component, ElementRef, HostBinding } from "@angular/core";
|
||||
import { coerceBooleanProperty } from "@angular/cdk/coercion";
|
||||
import { Component, ElementRef, HostBinding, Input } from "@angular/core";
|
||||
|
||||
@Component({
|
||||
selector: "[bitMenuItem]",
|
||||
@@ -9,29 +10,37 @@ export class MenuItemDirective implements FocusableOption {
|
||||
@HostBinding("class") classList = [
|
||||
"tw-block",
|
||||
"tw-w-full",
|
||||
"tw-py-1",
|
||||
"tw-px-4",
|
||||
"tw-py-1.5",
|
||||
"tw-px-3",
|
||||
"!tw-text-main",
|
||||
"!tw-no-underline",
|
||||
"tw-cursor-pointer",
|
||||
"tw-border-none",
|
||||
"tw-bg-background",
|
||||
"tw-text-left",
|
||||
"hover:tw-bg-secondary-100",
|
||||
"focus-visible:tw-bg-secondary-100",
|
||||
"hover:tw-bg-primary-100",
|
||||
"hover:!tw-underline",
|
||||
"focus-visible:tw-z-50",
|
||||
"focus-visible:tw-outline-none",
|
||||
"focus-visible:tw-ring",
|
||||
"focus-visible:tw-ring-offset-2",
|
||||
"focus-visible:tw-ring-primary-700",
|
||||
"focus-visible:tw-ring-2",
|
||||
"focus-visible:tw-rounded-lg",
|
||||
"focus-visible:tw-ring-inset",
|
||||
"focus-visible:tw-ring-primary-500",
|
||||
"active:!tw-ring-0",
|
||||
"active:!tw-ring-offset-0",
|
||||
"disabled:!tw-text-muted",
|
||||
"disabled:hover:tw-bg-background",
|
||||
"disabled:hover:!tw-no-underline",
|
||||
"disabled:tw-cursor-not-allowed",
|
||||
];
|
||||
@HostBinding("attr.role") role = "menuitem";
|
||||
@HostBinding("tabIndex") tabIndex = "-1";
|
||||
@HostBinding("attr.disabled")
|
||||
get disabledAttr() {
|
||||
return this.disabled || null; // native disabled attr must be null when false
|
||||
}
|
||||
|
||||
@Input({ transform: coerceBooleanProperty }) disabled?: boolean = false;
|
||||
|
||||
constructor(private elementRef: ElementRef) {}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<ng-template>
|
||||
<div
|
||||
(click)="closed.emit()"
|
||||
class="tw-flex tw-shrink-0 tw-flex-col tw-rounded tw-border tw-border-solid tw-border-secondary-600 tw-bg-background tw-bg-clip-padding tw-py-2 tw-overflow-y-auto"
|
||||
class="tw-flex tw-shrink-0 tw-flex-col tw-rounded-lg tw-border tw-border-solid tw-border-secondary-500 tw-bg-background tw-bg-clip-padding tw-py-1 tw-overflow-y-auto"
|
||||
[attr.role]="ariaRole"
|
||||
[attr.aria-label]="ariaLabel"
|
||||
cdkTrapFocus
|
||||
|
||||
@@ -31,7 +31,9 @@ export class MenuComponent implements AfterContentInit {
|
||||
|
||||
ngAfterContentInit() {
|
||||
if (this.ariaRole === "menu") {
|
||||
this.keyManager = new FocusKeyManager(this.menuItems).withWrap();
|
||||
this.keyManager = new FocusKeyManager(this.menuItems)
|
||||
.withWrap()
|
||||
.skipPredicate((item) => item.disabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user