[bugfix/chore] id poll options properly (#2379)

* aria-labels for polls, id poll options properly

* my bad, aria labels are for interactive elements
This commit is contained in:
tobi 2023-11-22 16:27:32 +01:00 committed by GitHub
parent 7a9b493f47
commit 71e0aaee3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View file

@ -113,6 +113,9 @@ type PollVoteRequest struct {
type WebPollOption struct {
PollOption
// ID of the parent poll.
PollID string
// Emojis contained on parent poll.
Emojis []Emoji

View file

@ -709,6 +709,7 @@ func (c *Converter) StatusToWebStatus(
webPollOption := apimodel.WebPollOption{
PollOption: option,
PollID: poll.ID,
Emojis: webStatus.Emojis,
LanguageTag: webStatus.LanguageTag,
VoteShare: voteShare,

View file

@ -38,8 +38,8 @@
<ul class="poll-options">
{{- range $index, $pollOption := .WebPollOptions }}
<li class="poll-option">
<label aria-hidden="true" for="option-{{- increment $index -}}" lang="{{- .LanguageTag.TagStr -}}">{{- emojify .Emojis (noescape $pollOption.Title) -}}</label>
<meter aria-hidden="true" id="option-{{- increment $index -}}" min="0" max="100" value="{{- $pollOption.VoteShare -}}">{{- $pollOption.VoteShare -}}&#37;</meter>
<label aria-hidden="true" for="poll-{{- $pollOption.PollID -}}-option-{{- increment $index -}}" lang="{{- .LanguageTag.TagStr -}}">{{- emojify .Emojis (noescape $pollOption.Title) -}}</label>
<meter aria-hidden="true" id="poll-{{- $pollOption.PollID -}}-option-{{- increment $index -}}" min="0" max="100" value="{{- $pollOption.VoteShare -}}">{{- $pollOption.VoteShare -}}&#37;</meter>
<div class="sr-only">Option {{ increment $index }}:&nbsp;<span lang="{{ .LanguageTag.TagStr }}">{{ emojify .Emojis (noescape $pollOption.Title) -}}</span></div>
<div class="poll-vote-summary">
<span class="poll-vote-share">{{- $pollOption.VoteShareStr -}}&#37;</span>