logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: 06551d447c0b702adeb3b16652b90b40fab090f7
parent 5f8988de929b067d1c0bdba037ddfec0b369d098
Author: HJ <30-hj@users.noreply.git.pleroma.social>
Date:   Fri, 10 Feb 2023 09:48:55 +0000

Merge branch 'tusooa/checkbox-accessibility' into 'develop'

Make checkbox settings accessible

See merge request pleroma/pleroma-fe!1778

Diffstat:

Msrc/App.scss14++++++++++++--
Msrc/components/checkbox/checkbox.vue9++++++---
Msrc/components/screen_reader_notice/screen_reader_notice.vue13+------------
Msrc/components/settings_modal/helpers/modified_indicator.vue2+-
4 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/src/App.scss b/src/App.scss @@ -580,8 +580,6 @@ textarea, } &[type="checkbox"] { - display: none; - &:checked + label::before { color: $fallback--text; color: var(--inputText, $fallback--text); @@ -887,3 +885,15 @@ option { opacity: 0; } /* stylelint-enable no-descending-specificity */ + +.visible-for-screenreader-only { + display: block; + width: 1px; + height: 1px; + margin: -1px; + overflow: hidden; + visibility: visible; + clip: rect(0 0 0 0); + padding: 0; + position: absolute; +} diff --git a/src/components/checkbox/checkbox.vue b/src/components/checkbox/checkbox.vue @@ -5,12 +5,16 @@ > <input type="checkbox" + class="visible-for-screenreader-only" :disabled="disabled" :checked="modelValue" :indeterminate="indeterminate" @change="$emit('update:modelValue', $event.target.checked)" > - <i class="checkbox-indicator" /> + <i + class="checkbox-indicator" + :aria-hidden="true" + /> <span v-if="!!$slots.default" class="label" @@ -33,6 +37,7 @@ export default { <style lang="scss"> @import "../../variables"; +@import "../../mixins"; .checkbox { position: relative; @@ -81,8 +86,6 @@ export default { } input[type="checkbox"] { - display: none; - &:checked + .checkbox-indicator::before { color: $fallback--text; color: var(--inputText, $fallback--text); diff --git a/src/components/screen_reader_notice/screen_reader_notice.vue b/src/components/screen_reader_notice/screen_reader_notice.vue @@ -1,6 +1,6 @@ <template> <div - class="screen-reader-text" + class="visible-for-screenreader-only" :aria-live="ariaLive" > {{ currentText }} @@ -8,14 +8,3 @@ </template> <script src="./screen_reader_notice.js"></script> - -<style lang="scss"> -.screen-reader-text { - display: block; - width: 1px; - height: 1px; - margin: -1px; - overflow: hidden; - visibility: visible; -} -</style> diff --git a/src/components/settings_modal/helpers/modified_indicator.vue b/src/components/settings_modal/helpers/modified_indicator.vue @@ -5,12 +5,12 @@ > <Popover trigger="hover" + :trigger-attrs="{ 'aria-label': $t('settings.setting_changed') }" > <template #trigger> &nbsp; <FAIcon icon="wrench" - :aria-label="$t('settings.setting_changed')" /> </template> <template #content>