1
0
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:
Victoria League
2024-06-07 10:25:16 -04:00
committed by GitHub
parent 42a98bc6b4
commit 15e6266014
4 changed files with 22 additions and 11 deletions

View File

@@ -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>

View File

@@ -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) {}

View File

@@ -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

View File

@@ -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);
}
}
}