1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-13 14:53:33 +00:00

[CL-295] Use aria-disabled on buttons (#15009)

* Use aria-disabled for button disabled state

* remove import from testing story

* use aria-disabled attr on bitLink button

* remove unnecessary story attrs

* remove disabled attr if on button element

* create caprture click util

* use caprture click util and fix tests

* fix lint errors

* fix event type

* combine click capture and attr modification

* fix lint error. Commit spec changes left out of last commit in error

* inject element ref

* move aria-disabled styles to common

* move disabled logic into util

* fix broken async actions stories

* fix broken tests asserting disabled attr

* have test check for string true vlalue

* fix Signal type

* fix form-field story import

* remove injector left in error

* aria-disable icon buttons

* update form component css selector to look for aria-disabled buttons

* use correct types. pass nativeElement directly

* add JSDoc comment for util function

---------

Co-authored-by: Will Martin <contact@willmartian.com>
This commit is contained in:
Bryan Cunningham
2025-07-08 16:13:25 -04:00
committed by GitHub
parent d5e7f3bd04
commit 682f1f83d9
12 changed files with 175 additions and 73 deletions

View File

@@ -9,6 +9,7 @@ import { ValidationService } from "@bitwarden/common/platform/abstractions/valid
import { ButtonModule } from "../button";
import { IconButtonModule } from "../icon-button";
import { AsyncActionsModule } from "./async-actions.module";
import { BitActionDirective } from "./bit-action.directive";
const template = /*html*/ `
@@ -20,6 +21,8 @@ const template = /*html*/ `
@Component({
template,
selector: "app-promise-example",
imports: [AsyncActionsModule, ButtonModule, IconButtonModule],
standalone: true,
})
class PromiseExampleComponent {
statusEmoji = "🟡";
@@ -36,6 +39,7 @@ class PromiseExampleComponent {
@Component({
template,
selector: "app-action-resolves-quickly",
imports: [AsyncActionsModule, ButtonModule, IconButtonModule],
})
class ActionResolvesQuicklyComponent {
statusEmoji = "🟡";
@@ -53,6 +57,7 @@ class ActionResolvesQuicklyComponent {
@Component({
template,
selector: "app-observable-example",
imports: [AsyncActionsModule, ButtonModule, IconButtonModule],
})
class ObservableExampleComponent {
action = () => {
@@ -63,6 +68,7 @@ class ObservableExampleComponent {
@Component({
template,
selector: "app-rejected-promise-example",
imports: [AsyncActionsModule, ButtonModule, IconButtonModule],
})
class RejectedPromiseExampleComponent {
action = async () => {
@@ -76,13 +82,15 @@ export default {
title: "Component Library/Async Actions/Standalone",
decorators: [
moduleMetadata({
declarations: [
imports: [
ButtonModule,
IconButtonModule,
BitActionDirective,
PromiseExampleComponent,
ObservableExampleComponent,
RejectedPromiseExampleComponent,
ActionResolvesQuicklyComponent,
],
imports: [ButtonModule, IconButtonModule, BitActionDirective],
providers: [
{
provide: ValidationService,