summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/api/model/poll.go3
-rw-r--r--internal/typeutils/internaltofrontend.go1
-rw-r--r--web/template/poll.tmpl4
3 files changed, 6 insertions, 2 deletions
diff --git a/internal/api/model/poll.go b/internal/api/model/poll.go
index 7eddb66ef..3eb801998 100644
--- a/internal/api/model/poll.go
+++ b/internal/api/model/poll.go
@@ -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
diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go
index 0668d44bb..cd53d9ae6 100644
--- a/internal/typeutils/internaltofrontend.go
+++ b/internal/typeutils/internaltofrontend.go
@@ -709,6 +709,7 @@ func (c *Converter) StatusToWebStatus(
webPollOption := apimodel.WebPollOption{
PollOption: option,
+ PollID: poll.ID,
Emojis: webStatus.Emojis,
LanguageTag: webStatus.LanguageTag,
VoteShare: voteShare,
diff --git a/web/template/poll.tmpl b/web/template/poll.tmpl
index bfc31a9dc..7aa323e4f 100644
--- a/web/template/poll.tmpl
+++ b/web/template/poll.tmpl
@@ -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>