Skip to content

Commit 3253555

Browse files
GerganaKremenskailhan007
GerganaKremenska
authored andcommitted
fix(ui5-card): update ACC support (#1042)
1 parent 501f22d commit 3253555

File tree

4 files changed

+39
-19
lines changed

4 files changed

+39
-19
lines changed

packages/main/src/Card.hbs

+10-9
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
class="{{classes.main}}"
33
dir="{{rtl}}"
44
role="region"
5-
aria-labelledby="{{_id}}-heading"
6-
aria-roledescription="{{ariaCardRoleDescription}}"
7-
>
5+
aria-labelledby="{{_id}}-desc {{_id}}-heading">
86
{{#if hasHeader}}
9-
<header class="{{classes.header}}"
7+
<div class="{{classes.header}}"
108
@click="{{_headerClick}}"
119
@keydown="{{_headerKeydown}}"
1210
@keyup="{{_headerKeyup}}"
13-
tabindex="{{tabindex}}"
14-
role="group"
15-
aria-labelledby="{{_id}}-heading {{_id}}-subtitle">
11+
role="{{ariaHeaderRole}}"
12+
aria-labelledby="{{_id}}-subtitle {{_id}}-status"
13+
aria-level="{{ariaLevel}}"
14+
aria-roledescription="{{ariaCardHeaderRoleDescription}}"
15+
tabindex="0">
1616

1717
<div class="ui5-card-avatar" aria-label="{{ariaCardAvatarLabel}}">
1818
<slot name="avatar"></slot>
@@ -27,11 +27,12 @@
2727
<div id="{{_id}}-subtitle" class="ui5-card-subtitle ">{{subtitle}}</div>
2828
{{/if}}
2929
</div>
30-
<span part="status" class="ui5-card-status">{{status}}</span>
31-
</header>
30+
<span id="{{_id}}-status" part="status" class="ui5-card-status">{{status}}</span>
31+
</div>
3232
{{/if}}
3333

3434
<section role="group" aria-label="{{ariaCardContentLabel}}">
3535
<slot></slot>
3636
</section>
37+
<span id="{{_id}}-desc" class="ui5-hidden-text">{{ariaCardRoleDescription}}</span>
3738
</div>

packages/main/src/Card.js

+17-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@ import { getRTL } from "@ui5/webcomponents-base/dist/config/RTL.js";
66
import CardTemplate from "./generated/templates/CardTemplate.lit.js";
77
import Icon from "./Icon.js";
88

9-
import { ARIA_ROLEDESCRIPTION_CARD, AVATAR_TOOLTIP, ARIA_LABEL_CARD_CONTENT } from "./generated/i18n/i18n-defaults.js";
9+
import {
10+
ARIA_ROLEDESCRIPTION_CARD,
11+
AVATAR_TOOLTIP,
12+
ARIA_LABEL_CARD_CONTENT,
13+
ARIA_ROLEDESCRIPTION_CARD_HEADER,
14+
ARIA_ROLEDESCRIPTION_INTERACTIVE_CARD_HEADER,
15+
} from "./generated/i18n/i18n-defaults.js";
1016

1117
// Styles
1218
import cardCss from "./generated/themes/Card.css.js";
@@ -177,8 +183,12 @@ class Card extends UI5Element {
177183
return !!this.avatar && !this.icon;
178184
}
179185

180-
get tabindex() {
181-
return this.headerInteractive ? "0" : undefined;
186+
get ariaHeaderRole() {
187+
return this.headerInteractive ? "button" : "heading";
188+
}
189+
190+
get ariaLevel() {
191+
return this.headerInteractive ? undefined : "3";
182192
}
183193

184194
get hasHeader() {
@@ -193,6 +203,10 @@ class Card extends UI5Element {
193203
return this.i18nBundle.getText(ARIA_ROLEDESCRIPTION_CARD);
194204
}
195205

206+
get ariaCardHeaderRoleDescription() {
207+
return this.headerInteractive ? this.i18nBundle.getText(ARIA_ROLEDESCRIPTION_INTERACTIVE_CARD_HEADER) : this.i18nBundle.getText(ARIA_ROLEDESCRIPTION_CARD_HEADER);
208+
}
209+
196210
get ariaCardAvatarLabel() {
197211
return this.i18nBundle.getText(AVATAR_TOOLTIP);
198212
}

packages/main/src/i18n/messagebundle.properties

+8-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ ARIA_LABEL_CARD_CONTENT=Card Content
77
#XBUT: Card aria-roledescription text
88
ARIA_ROLEDESCRIPTION_CARD=Card
99

10+
#XBUT: Card Header aria-roledescription text
11+
ARIA_ROLEDESCRIPTION_CARD_HEADER=Card Header
12+
13+
#XBUT: Card Header aria-roledescription interactive text
14+
ARIA_ROLEDESCRIPTION_INTERACTIVE_CARD_HEADER=Interactive Card Header
15+
1016
#XACT: ARIA announcement for the Avatar default tooltip
1117
AVATAR_TOOLTIP=Avatar
1218

@@ -235,7 +241,7 @@ SWITCH_ON=On
235241
#XACT: ARIA announcement for the switch off
236242
SWITCH_OFF=Off
237243

238-
#XACT: ACC next icon name in tab container
244+
#XACT: ACC next icon name in tab container
239245
TABCONTAINER_NEXT_ICON_ACC_NAME=Next
240246

241247
#XACT: ACC previous icon name in tab container
@@ -272,4 +278,4 @@ VALUE_STATE_ERROR=Invalid entry
272278
VALUE_STATE_WARNING=Warning issued
273279

274280
#XTOL: text that is appended to the tooltips of input fields etc. which are marked to be in success state
275-
VALUE_STATE_SUCCESS=Entry successfully validated
281+
VALUE_STATE_SUCCESS=Entry successfully validated

packages/main/src/themes/Card.css

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import "./InvisibleTextStyles.css";
2+
13
:host(:not([hidden])) {
24
display: inline-block;
35
width: 100%;
@@ -34,11 +36,8 @@
3436
border-bottom: none;
3537
}
3638

37-
.ui5-card-header:focus {
39+
.ui5-card-header:focus:before {
3840
outline: none;
39-
}
40-
41-
.ui5-card-header.ui5-card-header--interactive:focus:before {
4241
content: "";
4342
position: absolute;
4443
border: var(--_ui5_card_header_focus_border);
@@ -80,7 +79,7 @@
8079

8180
::slotted(img) {
8281
width: 100%;
83-
height: 100%;
82+
height: 100%;
8483
border-radius: 50%;
8584
}
8685

0 commit comments

Comments
 (0)