Skip to content

Commit

Permalink
[1.x] chore(core, tags): resolve a11y warnings in Admin Frontend (#…
Browse files Browse the repository at this point in the history
…4114)

* chore: add accessible label to scope removal button

* chore: add accessible label to edit tag button
  • Loading branch information
DavideIadeluca authored Nov 19, 2024
1 parent 00329ea commit 3450232
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
7 changes: 6 additions & 1 deletion extensions/tags/js/src/admin/components/TagsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ function tagItem(tag) {
<div className="TagListItem-info">
{tagIcon(tag)}
<span className="TagListItem-name">{tag.name()}</span>
<Button className="Button Button--link" icon="fas fa-pencil-alt" onclick={() => app.modal.show(EditTagModal, { model: tag })} />
<Button
className="Button Button--link"
icon="fas fa-pencil-alt"
aria-label={app.translator.trans('flarum-tags.admin.tags.edit_tag_label', { tag: tag.name() })}
onclick={() => app.modal.show(EditTagModal, { model: tag })}
/>
</div>
{!tag.isChild() && tag.position() !== null && (
<ol className="TagListItem-children TagList">
Expand Down
1 change: 1 addition & 0 deletions extensions/tags/locale/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ flarum-tags:
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."
create_primary_tag_button: Create Primary Tag
create_secondary_tag_button: Create Secondary Tag
edit_tag_label: Edit Tag {tag}
primary_heading: Primary Tags
secondary_heading: Secondary Tags
settings_heading: Settings
Expand Down
7 changes: 6 additions & 1 deletion framework/core/js/src/admin/components/PermissionGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ export default class PermissionGrid<CustomAttrs extends IPermissionGridAttrs = I
<th>
{scope.label}{' '}
{!!scope.onremove && (
<Button icon="fas fa-times" className="Button Button--text PermissionGrid-removeScope" onclick={scope.onremove} />
<Button
icon="fas fa-times"
className="Button Button--text PermissionGrid-removeScope"
aria-label={app.translator.trans('core.admin.permissions.remove_scope_label', { scope: scope.label })}
onclick={scope.onremove}
/>
)}
</th>
))}
Expand Down
1 change: 1 addition & 0 deletions framework/core/locale/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ core:
participate_heading: Participate
post_without_throttle_label: Reply multiple times without waiting
read_heading: Read
remove_scope_label: Remove scope of {scope}
rename_discussions_label: Rename discussions
reply_to_discussions_label: Reply to discussions
search_users_label: => core.ref.search_users
Expand Down

0 comments on commit 3450232

Please sign in to comment.