Merge branch 'tusooa/fix-poll-reg' into 'develop'

Fix poll interaction

See merge request pleroma/pleroma-fe!1788
This commit is contained in:
HJ 2023-02-19 17:19:15 +00:00
commit eec27700f0
2 changed files with 55 additions and 40 deletions

View File

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

View File

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