1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-22 16:29:09 +01:00

[PS-1386] Browser/Desktop/Web: Accessibility - Stop username regenerator button from losing focus (#3405)

* Make username regenerator button same as password one

it seems that (originally?) it wanted to be disabled at first and then become active again once the generator's async call was finished...but this seems unnecessary. removing all that extraneous stuff that doesn't seem to be actually doing anything makes this work just as well as the password generator button, and doesn't end up losing/resetting focus.

* Remove the `[disabled]` attribute from regenerate buttons

* Use `aria-disabled` instead of `disabled`, make click event conditional

* Make spinner show for `aria-disabled` controls as well
This commit is contained in:
Patrick H. Lauke 2022-12-23 00:18:18 +00:00 committed by GitHub
parent 288827f13a
commit e1aceca72b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 6 deletions

View File

@ -56,8 +56,8 @@
type="button"
appStopClick
appA11yTitle="{{ 'regenerateUsername' | i18n }}"
(click)="regenerate()"
[disabled]="$any(form).loading"
(click)="$any(form).loading ? false : regenerate()"
[attr.aria-disabled]="$any(form).loading ? 'true' : null"
>
<i
class="bwi bwi-lg bwi-generate"

View File

@ -51,8 +51,8 @@
class="icon-btn primary"
appStopClick
appA11yTitle="{{ 'regenerateUsername' | i18n }}"
(click)="regenerate()"
[disabled]="$any(form).loading"
(click)="$any(form).loading ? false : regenerate()"
[attr.aria-disabled]="$any(form).loading ? 'true' : null"
>
<i
class="bwi bwi-lg bwi-generate"

View File

@ -399,8 +399,8 @@
<button
type="button"
class="btn btn-submit btn-primary"
(click)="regenerate()"
[disabled]="$any(form).loading"
(click)="$any(form).loading ? false : regenerate()"
[attr.aria-disabled]="$any(form).loading ? 'true' : null"
>
<i class="bwi bwi-spinner bwi-spin" title="{{ 'loading' | i18n }}" aria-hidden="true"></i>
<span>{{ "regenerateUsername" | i18n }}</span>

View File

@ -175,6 +175,7 @@
}
&:disabled:not(.manual),
&[aria-disabled="true"]:not(.manual),
&.loading {
.bwi-spinner {
display: flex;