A11Y: do not default to label for aria-label (#14258)

This commit is contained in:
Joffrey JAFFEUX 2021-09-07 18:24:39 +02:00 committed by GitHub
parent f513266bcb
commit d51d94f771
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 16 additions and 12 deletions

View File

@ -85,15 +85,14 @@ export default Component.extend({
return translatedLabel;
},
@discourseComputed("ariaLabel", "translatedAriaLabel", "computedLabel")
computedAriaLabel(ariaLabel, translatedAriaLabel, computedLabel) {
@discourseComputed("ariaLabel", "translatedAriaLabel")
computedAriaLabel(ariaLabel, translatedAriaLabel) {
if (ariaLabel) {
return I18n.t(ariaLabel);
}
if (translatedAriaLabel) {
return translatedAriaLabel;
}
return computedLabel;
},
@discourseComputed("ariaExpanded")

View File

@ -99,7 +99,7 @@ addBulkButton("removeTags", "remove_tags", {
});
addBulkButton("deleteTopics", "delete", {
icon: "trash-alt",
class: "btn-danger",
class: "btn-danger delete-topics",
buttonVisible: function () {
return this.currentUser.staff;
},

View File

@ -61,6 +61,9 @@ export default Controller.extend(CanCheckEmails, {
isExpanded: !this.collapsedInfo,
icon: this.collapsedInfo ? "angle-double-down" : "angle-double-up",
label: this.collapsedInfo ? "expand_profile" : "collapse_profile",
ariaLabel: this.collapsedInfo
? "user.sr_expand_profile"
: "user.sr_collapse_profile",
action: this.collapsedInfo ? "expandProfile" : "collapseProfile",
};
}),

View File

@ -13,5 +13,5 @@
<div class="modal-footer">
{{d-button icon="trash-alt" class="btn-danger" action=(action "perform") label="admin.user.delete"}}
{{d-button action=(route-action "closeModal") label="cancel"}}
{{d-button action=(route-action "closeModal") label="cancel" class="cancel"}}
</div>

View File

@ -19,7 +19,7 @@
{{/each}}
{{d-button
class="btn-default"
class="btn-default notify"
label="topic.share.notify_users.title"
icon="hand-point-right"
action=(action "toggleNotifyUsers")
@ -27,7 +27,7 @@
{{#if allowInvites}}
{{d-button
class="btn-default"
class="btn-default invite"
label="topic.share.invite_users"
icon="user-plus"
action=(action "inviteUsers")

View File

@ -82,6 +82,7 @@
<li>
{{d-button
ariaExpanded=collapsedInfoState.isExpanded
ariaLabel=collapsedInfoState.ariaLabel
ariaControls="collapsed-info-panel"
class="btn-default"
label=(concat "user." collapsedInfoState.label)

View File

@ -59,7 +59,7 @@ acceptance("Review", function (needs) {
"it opens reject reason modal when user is rejected"
);
await click(".modal-footer button[aria-label='cancel']");
await click(".modal-footer .cancel");
await reviewableActionDropdown.expand();
await reviewableActionDropdown.selectRowByValue("reject_user_block");

View File

@ -31,14 +31,13 @@ acceptance("Share and Invite modal", function (needs) {
);
assert.ok(count("button[class*='share-']") > 1, "it shows social sources");
assert.ok(
exists(".btn[aria-label='Notify']"),
exists(".link-share-actions .notify"),
"it shows the notify button"
);
assert.ok(
exists(".btn[aria-label='Invite']"),
exists(".link-share-actions .invite"),
"it shows the invite button"
);
});

View File

@ -114,7 +114,7 @@ acceptance("Topic - Bulk Actions", function (needs) {
await click(queryAll("input.bulk-select")[1]);
await click(".bulk-select-btn");
await click(".modal-body button[aria-label='Delete Topics']");
await click(".modal-body .delete-topics");
assert.ok(
invisible(".topic-bulk-actions-modal"),

View File

@ -1040,7 +1040,9 @@ en:
use_current_timezone: "Use Current Timezone"
profile_hidden: "This user's public profile is hidden."
expand_profile: "Expand"
sr_expand_profile: "Expand profile details"
collapse_profile: "Collapse"
sr_collapse_profile: "Collapse profile details"
bookmarks: "Bookmarks"
bio: "About me"
timezone: "Timezone"