MOBILE-3753 menu: Add context to main menu badges
This commit is contained in:
		
							parent
							
								
									de6442daab
								
							
						
					
					
						commit
						4c59d4ce81
					
				| @ -47,6 +47,7 @@ export class AddonMessagesMainMenuHandlerService implements CoreMainMenuHandler, | |||||||
|         class: 'addon-messages-handler', |         class: 'addon-messages-handler', | ||||||
|         showBadge: true, // Do not check isMessageCountEnabled because we'll use fallback it not enabled.
 |         showBadge: true, // Do not check isMessageCountEnabled because we'll use fallback it not enabled.
 | ||||||
|         badge: '', |         badge: '', | ||||||
|  |         badgeA11yText: 'addon.messages.unreadconversations', | ||||||
|         loading: true, |         loading: true, | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -41,6 +41,7 @@ export class AddonNotificationsMainMenuHandlerService implements CoreMainMenuHan | |||||||
|         class: 'addon-notifications-handler', |         class: 'addon-notifications-handler', | ||||||
|         showBadge: true, |         showBadge: true, | ||||||
|         badge: '', |         badge: '', | ||||||
|  |         badgeA11yText: 'addon.notifications.unreadnotification', | ||||||
|         loading: true, |         loading: true, | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -16,11 +16,14 @@ | |||||||
|             [selected]="tab.page === selectedTab" |             [selected]="tab.page === selectedTab" | ||||||
|             [tabindex]="selectedTab == tab.page ? 0 : -1" |             [tabindex]="selectedTab == tab.page ? 0 : -1" | ||||||
|             [attr.aria-controls]="tab.id" |             [attr.aria-controls]="tab.id" | ||||||
|             [attr.aria-label]="tab.title | translate" |  | ||||||
|         > |         > | ||||||
|             <ion-icon [name]="tab.icon" aria-hidden="true"></ion-icon> |             <ion-icon [name]="tab.icon" aria-hidden="true"></ion-icon> | ||||||
|             <ion-label aria-hidden="true">{{ tab.title | translate }}</ion-label> |             <ion-label aria-hidden="true">{{ tab.title | translate }}</ion-label> | ||||||
|             <ion-badge *ngIf="tab.badge">{{ tab.badge }}</ion-badge> |             <ion-badge *ngIf="tab.badge" aria-hidden="true">{{ tab.badge }}</ion-badge> | ||||||
|  |             <span class="sr-only">{{ tab.title | translate }}</span> | ||||||
|  |             <span *ngIf="tab.badge && tab.badgeA11yText" class="sr-only"> | ||||||
|  |                 {{ tab.badgeA11yText | translate: {$a : tab.badge } }} | ||||||
|  |             </span> | ||||||
|         </ion-tab-button> |         </ion-tab-button> | ||||||
| 
 | 
 | ||||||
|         <ion-tab-button |         <ion-tab-button | ||||||
| @ -32,10 +35,10 @@ | |||||||
|             layout="label-hide" |             layout="label-hide" | ||||||
|             [tabindex]="selectedTab == morePageName ? 0 : -1" |             [tabindex]="selectedTab == morePageName ? 0 : -1" | ||||||
|             [attr.aria-controls]="morePageName" |             [attr.aria-controls]="morePageName" | ||||||
|             [attr.aria-label]="'core.more' | translate" |  | ||||||
|         > |         > | ||||||
|             <ion-icon name="fas-bars" aria-hidden="true"></ion-icon> |             <ion-icon name="fas-bars" aria-hidden="true"></ion-icon> | ||||||
|             <ion-label aria-hidden="true">{{ 'core.more' | translate }}</ion-label> |             <ion-label aria-hidden="true">{{ 'core.more' | translate }}</ion-label> | ||||||
|  |             <span class="sr-only">{{ 'core.more' | translate }}</span> | ||||||
|         </ion-tab-button> |         </ion-tab-button> | ||||||
|     </ion-tab-bar> |     </ion-tab-bar> | ||||||
| </ion-tabs> | </ion-tabs> | ||||||
|  | |||||||
| @ -30,8 +30,12 @@ | |||||||
|             <ion-label> |             <ion-label> | ||||||
|                 <h2>{{ handler.title | translate}}</h2> |                 <h2>{{ handler.title | translate}}</h2> | ||||||
|             </ion-label> |             </ion-label> | ||||||
|             <ion-badge slot="end" *ngIf="handler.showBadge" [hidden]="handler.loading || !handler.badge">{{handler.badge}} |             <ion-badge slot="end" *ngIf="handler.showBadge" [hidden]="handler.loading || !handler.badge" aria-hidden="true"> | ||||||
|  |                 {{handler.badge}} | ||||||
|             </ion-badge> |             </ion-badge> | ||||||
|  |             <span *ngIf="handler.showBadge && handler.badge && handler.badgeA11yText" class="sr-only"> | ||||||
|  |                 {{ handler.badgeA11yText | translate: {$a : handler.badge } }} | ||||||
|  |             </span> | ||||||
|             <ion-spinner slot="end" *ngIf="handler.showBadge && handler.loading"></ion-spinner> |             <ion-spinner slot="end" *ngIf="handler.showBadge && handler.loading"></ion-spinner> | ||||||
|         </ion-item> |         </ion-item> | ||||||
|         <ng-container *ngFor="let item of customItems"> |         <ng-container *ngFor="let item of customItems"> | ||||||
|  | |||||||
| @ -65,6 +65,11 @@ export interface CoreMainMenuHandlerData { | |||||||
|      */ |      */ | ||||||
|     badge?: string; |     badge?: string; | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Accessibility text to add on the badge. Only used if showBadge is true. | ||||||
|  |      */ | ||||||
|  |     badgeA11yText?: string; | ||||||
|  | 
 | ||||||
|     /** |     /** | ||||||
|      * If true, the badge number is being loaded. Only used if showBadge is true. |      * If true, the badge number is being loaded. Only used if showBadge is true. | ||||||
|      */ |      */ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user