From ba871d4e5ca55bb2cf45d1a441be3171c038b40c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 7 Mar 2019 14:35:30 +0100 Subject: [PATCH] MOBILE-2910 icon: Fix aria-label set --- .../pages/conversation-info/conversation-info.html | 2 +- .../pages/group-conversations/group-conversations.html | 2 +- src/addon/messages/pages/search/search.html | 2 +- .../mod/quiz/pages/navigation-modal/navigation-modal.html | 7 ++++--- .../context-menu/core-context-menu-popover.html | 2 +- src/components/icon/core-icon.html | 2 +- src/components/icon/icon.ts | 8 ++++++-- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/addon/messages/pages/conversation-info/conversation-info.html b/src/addon/messages/pages/conversation-info/conversation-info.html index 36af28369..393b078b6 100644 --- a/src/addon/messages/pages/conversation-info/conversation-info.html +++ b/src/addon/messages/pages/conversation-info/conversation-info.html @@ -27,7 +27,7 @@

- +

diff --git a/src/addon/messages/pages/group-conversations/group-conversations.html b/src/addon/messages/pages/group-conversations/group-conversations.html index e4d916c38..10d5c3052 100644 --- a/src/addon/messages/pages/group-conversations/group-conversations.html +++ b/src/addon/messages/pages/group-conversations/group-conversations.html @@ -100,7 +100,7 @@

- +

{{ conversation.unreadcount }} diff --git a/src/addon/messages/pages/search/search.html b/src/addon/messages/pages/search/search.html index 43dfbd4c5..4a9ba7621 100644 --- a/src/addon/messages/pages/search/search.html +++ b/src/addon/messages/pages/search/search.html @@ -34,7 +34,7 @@

- +

{{result.lastmessagedate | coreDateDayOrTime}} diff --git a/src/addon/mod/quiz/pages/navigation-modal/navigation-modal.html b/src/addon/mod/quiz/pages/navigation-modal/navigation-modal.html index ded960206..a68cdaa43 100644 --- a/src/addon/mod/quiz/pages/navigation-modal/navigation-modal.html +++ b/src/addon/mod/quiz/pages/navigation-modal/navigation-modal.html @@ -25,9 +25,10 @@ {{ 'core.question.questionno' | translate:{$a: question.number} }} {{ 'core.question.information' | translate }} - - - + + + + diff --git a/src/components/context-menu/core-context-menu-popover.html b/src/components/context-menu/core-context-menu-popover.html index f3c0d2323..18905549d 100644 --- a/src/components/context-menu/core-context-menu-popover.html +++ b/src/components/context-menu/core-context-menu-popover.html @@ -1,7 +1,7 @@ {{title}} - + diff --git a/src/components/icon/core-icon.html b/src/components/icon/core-icon.html index 54452fe8f..8e4a85f3a 100644 --- a/src/components/icon/core-icon.html +++ b/src/components/icon/core-icon.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/components/icon/icon.ts b/src/components/icon/icon.ts index 50351f582..0321a6485 100644 --- a/src/components/icon/icon.ts +++ b/src/components/icon/icon.ts @@ -37,6 +37,8 @@ export class CoreIconComponent implements OnInit, OnDestroy { // FontAwesome params. @Input('fixed-width') fixedWidth: string; + @Input('label') ariaLabel?: string; + protected element: HTMLElement; protected newElement: HTMLElement; @@ -54,8 +56,6 @@ export class CoreIconComponent implements OnInit, OnDestroy { this.newElement.classList.add('icon'); this.newElement.classList.add('fa'); this.newElement.classList.add(this.name); - this.newElement.setAttribute('aria-hidden', 'true'); - this.newElement.setAttribute('role', 'img'); if (this.isTrueProperty(this.fixedWidth)) { this.newElement.classList.add('fa-fw'); } @@ -66,6 +66,10 @@ export class CoreIconComponent implements OnInit, OnDestroy { this.newElement = this.element.firstElementChild; } + !this.ariaLabel && this.newElement.setAttribute('aria-hidden', 'true'); + !this.ariaLabel && this.newElement.setAttribute('role', 'presentation'); + this.ariaLabel && this.newElement.setAttribute('aria-label', this.ariaLabel); + const attrs = this.element.attributes; for (let i = attrs.length - 1; i >= 0; i--) { if (attrs[i].name == 'class') {