mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-22 16:29:09 +01:00
[PM-2532][PM-2430][Desktop] Fix Region Selector Issues (#5824)
* pull in a11y changes from PR #5532 * add focus to popup when selected via keyboard * make popup close upon outside click * prevent close() from running twice on click * pull in typo fix changes from PR #5530 (addressing PM-2433) * add class to make backdrop transparent * Change toggle button and dialog buttons for region selection (#5532) * `<a>` elements without `href` don't take focus, currently making the region selection trigger not operable with keyboard - changing to `<button>` * region buttons now convey their state (selected or not) with `aria-pressed` Co-authored-by: rr-bw <102181210+rr-bw@users.noreply.github.com> * remove span * cleanup browser styles * cleanup desktop styles --------- Co-authored-by: Patrick H. Lauke <redux@splintered.co.uk>
This commit is contained in:
parent
b6ea1b1f40
commit
d21cc261e6
@ -9,7 +9,7 @@
|
|||||||
<label for="email">{{ "emailAddress" | i18n }}</label>
|
<label for="email">{{ "emailAddress" | i18n }}</label>
|
||||||
<input id="email" type="email" formControlName="email" appInputVerbatim="false" />
|
<input id="email" type="email" formControlName="email" appInputVerbatim="false" />
|
||||||
</div>
|
</div>
|
||||||
<environment-selector class="environment-selector-padding"></environment-selector>
|
<environment-selector></environment-selector>
|
||||||
<div class="remember-email-check">
|
<div class="remember-email-check">
|
||||||
<input
|
<input
|
||||||
id="rememberEmail"
|
id="rememberEmail"
|
||||||
|
@ -51,15 +51,11 @@ html.browser_safari {
|
|||||||
color: $text-muted;
|
color: $text-muted;
|
||||||
line-height: 25px;
|
line-height: 25px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
padding-left: 5px;
|
padding-left: 15px;
|
||||||
|
|
||||||
label {
|
span {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
font-size: $font-size-small;
|
||||||
|
|
||||||
a,
|
|
||||||
a label:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +87,3 @@ html.browser_safari {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.environment-selector-padding {
|
|
||||||
padding-left: 10px;
|
|
||||||
}
|
|
||||||
|
@ -18,15 +18,11 @@
|
|||||||
color: $text-muted;
|
color: $text-muted;
|
||||||
line-height: 25px;
|
line-height: 25px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
padding-left: 5px;
|
padding-left: 15px;
|
||||||
|
|
||||||
label {
|
span {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
font-size: $font-size-small;
|
||||||
|
|
||||||
a,
|
|
||||||
a label:hover {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,40 +1,51 @@
|
|||||||
<label class="environment-selector-btn">
|
<div class="environment-selector-btn">
|
||||||
{{ "loggingInOn" | i18n }}:
|
{{ "loggingInOn" | i18n }}:
|
||||||
<a
|
<button
|
||||||
|
type="button"
|
||||||
(click)="toggle(null)"
|
(click)="toggle(null)"
|
||||||
cdkOverlayOrigin
|
cdkOverlayOrigin
|
||||||
#trigger="cdkOverlayOrigin"
|
#trigger="cdkOverlayOrigin"
|
||||||
aria-haspopup="menu"
|
aria-haspopup="dialog"
|
||||||
aria-controls="cdk-overlay-container"
|
aria-controls="cdk-overlay-container"
|
||||||
[ngSwitch]="selectedEnvironment"
|
[ngSwitch]="selectedEnvironment"
|
||||||
>
|
>
|
||||||
<label *ngSwitchCase="ServerEnvironmentType.US" class="text-primary">{{
|
<span *ngSwitchCase="ServerEnvironmentType.US" class="text-primary">{{
|
||||||
"usDomain" | i18n
|
"usDomain" | i18n
|
||||||
}}</label>
|
}}</span>
|
||||||
<label *ngSwitchCase="ServerEnvironmentType.EU" class="text-primary">{{
|
<span *ngSwitchCase="ServerEnvironmentType.EU" class="text-primary">{{
|
||||||
"euDomain" | i18n
|
"euDomain" | i18n
|
||||||
}}</label>
|
}}</span>
|
||||||
<label *ngSwitchCase="ServerEnvironmentType.SelfHosted" class="text-primary">{{
|
<span *ngSwitchCase="ServerEnvironmentType.SelfHosted" class="text-primary">{{
|
||||||
"selfHostedServer" | i18n
|
"selfHostedServer" | i18n
|
||||||
}}</label>
|
}}</span>
|
||||||
<i class="bwi bwi-fw bwi-sm bwi-angle-down" aria-hidden="true"></i>
|
<i class="bwi bwi-fw bwi-sm bwi-angle-down" aria-hidden="true"></i>
|
||||||
</a>
|
</button>
|
||||||
</label>
|
</div>
|
||||||
|
|
||||||
<ng-template
|
<ng-template
|
||||||
cdkConnectedOverlay
|
cdkConnectedOverlay
|
||||||
[cdkConnectedOverlayOrigin]="trigger"
|
[cdkConnectedOverlayOrigin]="trigger"
|
||||||
(backdropClick)="close()"
|
|
||||||
(detach)="close()"
|
|
||||||
[cdkConnectedOverlayOpen]="isOpen"
|
[cdkConnectedOverlayOpen]="isOpen"
|
||||||
[cdkConnectedOverlayPositions]="overlayPosition"
|
[cdkConnectedOverlayPositions]="overlayPosition"
|
||||||
|
[cdkConnectedOverlayHasBackdrop]="true"
|
||||||
|
[cdkConnectedOverlayBackdropClass]="'cdk-overlay-transparent-backdrop'"
|
||||||
|
(backdropClick)="isOpen = false"
|
||||||
|
(detach)="close()"
|
||||||
>
|
>
|
||||||
<div class="box-content">
|
<div class="box-content">
|
||||||
<div class="environment-selector-dialog" [@transformPanel]="'open'" role="dialog">
|
<div
|
||||||
|
class="environment-selector-dialog"
|
||||||
|
[@transformPanel]="'open'"
|
||||||
|
cdkTrapFocus
|
||||||
|
cdkTrapFocusAutoCapture
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="environment-selector-dialog-item"
|
class="environment-selector-dialog-item"
|
||||||
(click)="toggle(ServerEnvironmentType.US)"
|
(click)="toggle(ServerEnvironmentType.US)"
|
||||||
|
[attr.aria-pressed]="selectedEnvironment === ServerEnvironmentType.US ? 'true' : 'false'"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
class="bwi bwi-fw bwi-sm bwi-check"
|
class="bwi bwi-fw bwi-sm bwi-check"
|
||||||
@ -51,6 +62,7 @@
|
|||||||
type="button"
|
type="button"
|
||||||
class="environment-selector-dialog-item"
|
class="environment-selector-dialog-item"
|
||||||
(click)="toggle(ServerEnvironmentType.EU)"
|
(click)="toggle(ServerEnvironmentType.EU)"
|
||||||
|
[attr.aria-pressed]="selectedEnvironment === ServerEnvironmentType.EU ? 'true' : 'false'"
|
||||||
*ngIf="euServerFlagEnabled"
|
*ngIf="euServerFlagEnabled"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
@ -68,6 +80,9 @@
|
|||||||
type="button"
|
type="button"
|
||||||
class="environment-selector-dialog-item"
|
class="environment-selector-dialog-item"
|
||||||
(click)="toggle(ServerEnvironmentType.SelfHosted)"
|
(click)="toggle(ServerEnvironmentType.SelfHosted)"
|
||||||
|
[attr.aria-pressed]="
|
||||||
|
selectedEnvironment === ServerEnvironmentType.SelfHosted ? 'true' : 'false'
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<i
|
<i
|
||||||
class="bwi bwi-fw bwi-sm bwi-check"
|
class="bwi bwi-fw bwi-sm bwi-check"
|
||||||
|
Loading…
Reference in New Issue
Block a user