Skip to content

Commit 702dadb

Browse files
authored
Merge pull request #1813 from dpalou/MOBILE-2819
Mobile 2819
2 parents 3b4d3fd + 88a0a28 commit 702dadb

File tree

5 files changed

+41
-12
lines changed

5 files changed

+41
-12
lines changed

src/addon/mod/data/fields/picture/component/addon-mod-data-field-picture.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
<ion-input type="text" [formControlName]="'f_'+field.id" [placeholder]="field.name"></ion-input>
1212
</span>
1313

14-
<span *ngIf="mode == 'list' && imageUrl" (click)="gotoEntry.emit(entryId)"><img [src]="imageUrl" [alt]="title" [title]="title" class="core-media-adapt-width list_picture" core-external-content/></span>
14+
<span *ngIf="mode == 'list' && imageUrl" (click)="gotoEntry.emit(entryId)"><img [src]="imageUrl" [alt]="title" class="core-media-adapt-width list_picture" core-external-content/></span>
1515

16-
<img *ngIf="mode == 'show' && imageUrl" [src]="imageUrl" [alt]="title" [title]="title" class="core-media-adapt-width list_picture" [attr.width]="width" [attr.height]="height" core-external-content/>
16+
<img *ngIf="mode == 'show' && imageUrl" [src]="imageUrl" [alt]="title" class="core-media-adapt-width list_picture" [attr.width]="width" [attr.height]="height" core-external-content/>

src/components/tabs/core-tabs.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<core-loading [hideUntil]="hideUntil" class="core-loading-center">
22
<div class="core-tabs-bar" #topTabs [hidden]="!tabs || numTabsShown < 2" id="core-tabs-bar">
33
<ion-row>
4-
<ion-col class="col-with-arrow" (click)="slidePrev()" no-padding col-1 aria-hidden="true">
4+
<ion-col class="col-with-arrow" (click)="slidePrev()" no-padding col-1>
55
<ion-icon *ngIf="showPrevButton" name="arrow-back" md="ios-arrow-back"></ion-icon>
66
</ion-col>
77
<ion-col no-padding col-10>
@@ -15,7 +15,7 @@
1515
</ng-container>
1616
</ion-slides>
1717
</ion-col>
18-
<ion-col class="col-with-arrow" (click)="slideNext()" no-padding col-1 aria-hidden="true">
18+
<ion-col class="col-with-arrow" (click)="slideNext()" no-padding col-1>
1919
<ion-icon *ngIf="showNextButton" name="arrow-forward" md="ios-arrow-forward"></ion-icon>
2020
</ion-col>
2121
</ion-row>

src/components/tabs/tab.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,7 @@ export class CoreTabComponent implements OnInit, OnDestroy {
5555

5656
if (this.initialized && hasChanged) {
5757
this.tabs.tabVisibilityChanged();
58-
59-
this.tabElement = document.getElementById(this.id + '-tab');
60-
this.tabElement && this.tabElement.setAttribute('aria-hidden', !this._show);
58+
this.updateAriaHidden();
6159
}
6260
}
6361
}
@@ -96,8 +94,7 @@ export class CoreTabComponent implements OnInit, OnDestroy {
9694
this.initialized = true;
9795

9896
setTimeout(() => {
99-
this.tabElement = document.getElementById(this.id + '-tab');
100-
this.tabElement && this.tabElement.setAttribute('aria-hidden', !this._show);
97+
this.updateAriaHidden();
10198
}, 1000);
10299
}
103100

@@ -116,8 +113,8 @@ export class CoreTabComponent implements OnInit, OnDestroy {
116113

117114
this.tabElement = this.tabElement || document.getElementById(this.id + '-tab');
118115

116+
this.updateAriaHidden();
119117
this.tabElement && this.tabElement.setAttribute('aria-selected', true);
120-
this.tabElement && this.tabElement.setAttribute('aria-hidden', !this._show);
121118

122119
this.loaded = true;
123120
this.ionSelect.emit(this);
@@ -137,8 +134,8 @@ export class CoreTabComponent implements OnInit, OnDestroy {
137134
* Unselect tab.
138135
*/
139136
unselectTab(): void {
137+
this.updateAriaHidden();
140138
this.tabElement && this.tabElement.setAttribute('aria-selected', false);
141-
this.tabElement && this.tabElement.setAttribute('aria-hidden', true);
142139

143140
this.element.classList.remove('selected');
144141
this.showHideNavBarButtons(false);
@@ -176,4 +173,17 @@ export class CoreTabComponent implements OnInit, OnDestroy {
176173
instances[i].forceHide(!show);
177174
}
178175
}
176+
177+
/**
178+
* Update aria hidden attribute.
179+
*/
180+
updateAriaHidden(): void {
181+
if (!this.tabElement) {
182+
this.tabElement = document.getElementById(this.id + '-tab');
183+
}
184+
185+
if (this.tabElement) {
186+
this.tabElement && this.tabElement.setAttribute('aria-hidden', !this._show);
187+
}
188+
}
179189
}

src/components/tabs/tabs.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
327327
// Current tab has changed, don't slide to initial anymore.
328328
this.shouldSlideToInitial = false;
329329
}
330+
331+
this.updateAriaHidden(); // Sliding resets the aria-hidden, update it.
330332
}
331333

332334
/**
@@ -354,11 +356,18 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
354356
if (this.shouldSlideToInitial) {
355357
this.slides.slideTo(this.selected, 0);
356358
this.shouldSlideToInitial = false;
359+
this.updateAriaHidden(); // Slide's slideTo() sets aria-hidden to true, update it.
357360
}
358361
}, 400);
362+
363+
return;
359364
} else if (this.selected) {
360365
this.hasSliddenToInitial = true;
361366
}
367+
368+
setTimeout(() => {
369+
this.updateAriaHidden(); // Slide's update() sets aria-hidden to true, update it.
370+
}, 400);
362371
});
363372
}
364373

@@ -458,6 +467,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
458467

459468
if (this.selected) {
460469
this.slides.slideTo(index);
470+
this.updateAriaHidden(); // Slide's slideTo() sets aria-hidden to true, update it.
461471
}
462472

463473
this.selectHistory.push(index);
@@ -491,6 +501,15 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
491501
this.calculateSlides();
492502
}
493503

504+
/**
505+
* Update aria-hidden of all tabs.
506+
*/
507+
protected updateAriaHidden(): void {
508+
this.tabs.forEach((tab, index) => {
509+
tab.updateAriaHidden();
510+
});
511+
}
512+
494513
/**
495514
* Component destroyed.
496515
*/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<a *ngIf="completion" (click)="completionClicked($event)">
2-
<img [src]="completionImage" [alt]="completionDescription" [title]="completionDescription">
2+
<img [src]="completionImage" [alt]="completionDescription">
33
</a>

0 commit comments

Comments
 (0)