A11Y: add aria-label to embedded jump link (#20117)

This commit is contained in:
Kris 2023-02-02 09:41:39 -05:00 committed by GitHub
parent 5a7b942aff
commit adbf69c300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -8,15 +8,15 @@ createWidget("post-link-arrow", {
tagName: "div.post-link-arrow", tagName: "div.post-link-arrow",
template: hbs` template: hbs`
{{#if attrs.above}} <a href={{attrs.shareUrl}} class="post-info arrow" title={{i18n "topic.jump_reply"}} aria-label={{i18n
<a href={{attrs.shareUrl}} class="post-info arrow" title={{i18n "topic.jump_reply_up"}}> "topic.jump_reply_aria" username=attrs.name
}}>
{{#if attrs.above}}
{{d-icon "arrow-up"}} {{d-icon "arrow-up"}}
</a> {{else}}
{{else}}
<a href={{attrs.shareUrl}} class="post-info arrow" title={{i18n "topic.jump_reply_down"}}>
{{d-icon "arrow-down"}} {{d-icon "arrow-down"}}
{{/if}}
</a> </a>
{{/if}}
`, `,
}); });
@ -44,6 +44,7 @@ export default createWidget("embedded-post", {
h("div.topic-meta-data.embedded-reply", [ h("div.topic-meta-data.embedded-reply", [
this.attach("poster-name", attrs), this.attach("poster-name", attrs),
this.attach("post-link-arrow", { this.attach("post-link-arrow", {
name: attrs.username,
above: state.above, above: state.above,
shareUrl: attrs.customShare, shareUrl: attrs.customShare,
}), }),

View File

@ -2976,8 +2976,8 @@ en:
browse_all_tags_or_latest: "<a href='%{basePath}/tags'>Browse all tags</a> or <a href='%{basePath}/latest'>view latest topics</a>." browse_all_tags_or_latest: "<a href='%{basePath}/tags'>Browse all tags</a> or <a href='%{basePath}/latest'>view latest topics</a>."
suggest_create_topic: Ready to <a href>start a new conversation?</a> suggest_create_topic: Ready to <a href>start a new conversation?</a>
jump_reply_up: jump to earlier reply jump_reply: "Jump to post's original location"
jump_reply_down: jump to later reply jump_reply_aria: "Jump to @%{username}'s post in its original location"
deleted: "The topic has been deleted" deleted: "The topic has been deleted"
slow_mode_update: slow_mode_update: