Skip to content

Commit 3450232

Browse files
[1.x] chore(core, tags): resolve a11y warnings in Admin Frontend (#4114)
* chore: add accessible label to scope removal button * chore: add accessible label to edit tag button
1 parent 00329ea commit 3450232

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

extensions/tags/js/src/admin/components/TagsPage.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ function tagItem(tag) {
1616
<div className="TagListItem-info">
1717
{tagIcon(tag)}
1818
<span className="TagListItem-name">{tag.name()}</span>
19-
<Button className="Button Button--link" icon="fas fa-pencil-alt" onclick={() => app.modal.show(EditTagModal, { model: tag })} />
19+
<Button
20+
className="Button Button--link"
21+
icon="fas fa-pencil-alt"
22+
aria-label={app.translator.trans('flarum-tags.admin.tags.edit_tag_label', { tag: tag.name() })}
23+
onclick={() => app.modal.show(EditTagModal, { model: tag })}
24+
/>
2025
</div>
2126
{!tag.isChild() && tag.position() !== null && (
2227
<ol className="TagListItem-children TagList">

extensions/tags/locale/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ flarum-tags:
5656
about_tags_text: "Tags are used to categorize discussions. Primary tags are like traditional forum categories: they can be arranged in a two-level hierarchy. Secondary tags do not have hierarchy or order, and are useful for micro-categorization."
5757
create_primary_tag_button: Create Primary Tag
5858
create_secondary_tag_button: Create Secondary Tag
59+
edit_tag_label: Edit Tag {tag}
5960
primary_heading: Primary Tags
6061
secondary_heading: Secondary Tags
6162
settings_heading: Settings

framework/core/js/src/admin/components/PermissionGrid.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,12 @@ export default class PermissionGrid<CustomAttrs extends IPermissionGridAttrs = I
5757
<th>
5858
{scope.label}{' '}
5959
{!!scope.onremove && (
60-
<Button icon="fas fa-times" className="Button Button--text PermissionGrid-removeScope" onclick={scope.onremove} />
60+
<Button
61+
icon="fas fa-times"
62+
className="Button Button--text PermissionGrid-removeScope"
63+
aria-label={app.translator.trans('core.admin.permissions.remove_scope_label', { scope: scope.label })}
64+
onclick={scope.onremove}
65+
/>
6166
)}
6267
</th>
6368
))}

framework/core/locale/core.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ core:
226226
participate_heading: Participate
227227
post_without_throttle_label: Reply multiple times without waiting
228228
read_heading: Read
229+
remove_scope_label: Remove scope of {scope}
229230
rename_discussions_label: Rename discussions
230231
reply_to_discussions_label: Reply to discussions
231232
search_users_label: => core.ref.search_users

0 commit comments

Comments
 (0)