Add accessibility role to notification div
This commit is contained in:
parent
27243f96f1
commit
54f16adca8
|
@ -53,12 +53,14 @@
|
||||||
<p-toast position="bottom-right">
|
<p-toast position="bottom-right">
|
||||||
<ng-template let-message pTemplate="message">
|
<ng-template let-message pTemplate="message">
|
||||||
<div class="notification-block">
|
<div class="notification-block">
|
||||||
<div class="message">
|
<div class="message" [attr.role]="getNotificationRole(message)">
|
||||||
<h3>{{ message.summary }}</h3>
|
<h3>{{ message.summary }}</h3>
|
||||||
<p>{{ message.detail }}</p>
|
<p>{{ message.detail }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<my-global-icon [iconName]="getNotificationIcon(message)"></my-global-icon>
|
<button class="border-0 padding-0">
|
||||||
|
<my-global-icon [iconName]="getNotificationIcon(message)"></my-global-icon>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</p-toast>
|
</p-toast>
|
||||||
|
|
|
@ -160,17 +160,33 @@ export class AppComponent implements OnInit, AfterViewInit {
|
||||||
this.screenService.isBroadcastMessageDisplayed = false
|
this.screenService.isBroadcastMessageDisplayed = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
getNotificationIcon (message: { severity: 'success' | 'error' | 'info' }): GlobalIconName {
|
getNotificationIcon (message: { severity: 'success' | 'error' | 'info' }): GlobalIconName {
|
||||||
switch (message.severity) {
|
switch (message.severity) {
|
||||||
case 'error':
|
case 'error':
|
||||||
return 'cross'
|
return 'cross'
|
||||||
|
|
||||||
case 'success':
|
case 'success':
|
||||||
return 'tick'
|
return 'tick'
|
||||||
|
|
||||||
case 'info':
|
case 'info':
|
||||||
return 'help'
|
return 'help'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getNotificationRole (message: { severity: 'success' | 'error' | 'info' }) {
|
||||||
|
switch (message.severity) {
|
||||||
|
case 'error':
|
||||||
|
return 'alert'
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 'status'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
private initRouteEvents () {
|
private initRouteEvents () {
|
||||||
const eventsObs = this.router.events
|
const eventsObs = this.router.events
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user