Fix poll interaction

This commit is contained in:
tusooa 2023-02-18 13:40:42 -05:00
parent e45dff0b26
commit 2316bcc842
No known key found for this signature in database
GPG Key ID: 7B467EDE43A08224
2 changed files with 55 additions and 40 deletions

View File

@ -12,7 +12,8 @@ export default {
data () {
return {
loading: false,
choices: []
choices: [],
randomSeed: `${Math.random()}`.replace('.', '-')
}
},
created () {

View File

@ -2,6 +2,9 @@
<div
class="poll"
:class="containerClass"
>
<div
:role="showResults ? 'section' : (poll.multiple ? 'group' : 'radiogroup')"
>
<div
v-for="(option, index) in options"
@ -30,11 +33,16 @@
</div>
<div
v-else
tabindex="0"
:role="poll.multiple ? 'checkbox' : 'radio'"
:aria-labelledby="`option-vote-${randomSeed}-${index}`"
:aria-checked="choices[index]"
@click="activateOption(index)"
>
<input
v-if="poll.multiple"
type="checkbox"
class="poll-checkbox"
:disabled="loading"
:value="index"
>
@ -46,6 +54,7 @@
>
<label class="option-vote">
<RichContent
:id="`option-vote-${randomSeed}-${index}`"
:html="option.title_html"
:handle-links="false"
:emoji="emoji"
@ -53,6 +62,7 @@
</label>
</div>
</div>
</div>
<div class="footer faint">
<button
v-if="!showResults"
@ -161,5 +171,9 @@
padding: 0 0.5em;
margin-right: 0.5em;
}
.poll-checkbox {
display: none;
}
}
</style>