MOBILE-3746 a11y: Highlight focused element

main
Dani Palou 2021-05-11 10:04:32 +02:00
parent ecab609487
commit 35c2a569b5
5 changed files with 33 additions and 11 deletions

View File

@ -86,7 +86,7 @@
<ion-item *ngFor="let discussion of discussions.items" <ion-item *ngFor="let discussion of discussions.items"
class="addon-mod-forum-discussion" detail="true" class="addon-mod-forum-discussion" detail="true"
[lines]="discussion.groupname && 'none'" [attr.aria-current]="discussions.getItemAriaCurrent(discussion)" [lines]="discussion.groupname && 'none'" [attr.aria-current]="discussions.getItemAriaCurrent(discussion)"
(click)="discussions.select(discussion)"> (click)="discussions.select(discussion)" button>
<ion-label> <ion-label>
<div class="addon-mod-forum-discussion-title"> <div class="addon-mod-forum-discussion-title">
<h2 class="ion-text-wrap"> <h2 class="ion-text-wrap">

View File

@ -19,19 +19,19 @@
--padding-end: 10px; --padding-end: 10px;
--padding-bottom: 10px; --padding-bottom: 10px;
--padding-start: 16px; --padding-start: 16px;
&.md {
--background-activated-opacity: 0;
--background-focused-opacity: .12;
}
&.ios {
--background-activated-opacity: .12;
--background-focused-opacity: .15;
}
} }
} }
:host-context(.md) {
--background-activated-opacity: 0;
--background-focused-opacity: .12;
}
:host-context(.ios) {
--background-activated-opacity: .12;
--background-focused-opacity: .15;
}
ion-select, ion-select,
ion-button { ion-button {
background: var(--background); background: var(--background);
@ -42,6 +42,11 @@ ion-button {
overflow: hidden; overflow: hidden;
margin: 8px; margin: 8px;
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, .2), 0 2px 2px 0 rgba(0, 0, 0, .14), 0 1px 5px 0 rgba(0, 0, 0, .12); box-shadow: 0 3px 1px -2px rgba(0, 0, 0, .2), 0 2px 2px 0 rgba(0, 0, 0, .14), 0 1px 5px 0 rgba(0, 0, 0, .12);
&:focus,
&:focus-within {
border: 2px solid var(--a11y-focus-outline-color);
}
} }
ion-select { ion-select {

View File

@ -14,6 +14,7 @@
[hidden]="!hideUntil" [hidden]="!hideUntil"
[id]="tab.id! + '-tab'" [id]="tab.id! + '-tab'"
class="tab-slide" class="tab-slide"
tabindex="-1"
[class.selected]="selected == tab.id"> [class.selected]="selected == tab.id">
<ion-tab-button <ion-tab-button
(ionTabButtonClick)="selectTab(tab.id, $event)" (ionTabButtonClick)="selectTab(tab.id, $event)"

View File

@ -500,3 +500,18 @@ img.core-media-adapt-width {
audio.core-media-adapt-width { audio.core-media-adapt-width {
width: 100%; width: 100%;
} }
// Focus highlight for accessibility.
.ion-focused,
ion-input.has-focus,
.ion-focused ion-toggle:focus-within,
.ion-focused ion-select:focus-within,
.ion-focused ion-checkbox:focus-within,
.ion-focused ion-radio:focus-within {
border: 2px solid var(--a11y-focus-outline-color);
}
// Treat cases where there's a focusable element inside an item, like a button.
ion-item.ion-focused:not(:focus) {
border: none;
}

View File

@ -64,6 +64,7 @@
// Accessibility vars. // Accessibility vars.
--a11y-min-target-size: 44px; --a11y-min-target-size: 44px;
--a11y-focus-outline-color: #005ECC;
--module-icon-size: 24px; --module-icon-size: 24px;