Skip to content

Commit

Permalink
Merge pull request #43066 from nextcloud/backport/42732/stable28
Browse files Browse the repository at this point in the history
[stable28] fix(a11y): Fix informative graphics contrast of user status icons
  • Loading branch information
susnux authored Feb 2, 2024
2 parents 5e22ee1 + 579242e commit 3658380
Show file tree
Hide file tree
Showing 21 changed files with 38 additions and 82 deletions.
6 changes: 4 additions & 2 deletions apps/dashboard/src/DashboardApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
:checked="isStatusActive(status)"
@input="updateStatusCheckbox(status, $event.target.checked)">
<label :for="'status-checkbox-' + status">
<span :class="statusInfo[status].icon" aria-hidden="true" />
<NcUserStatusIcon v-if="status === 'status'" status="online" aria-hidden="true" />
<span v-else :class="statusInfo[status].icon" aria-hidden="true" />
{{ statusInfo[status].text }}
</label>
</li>
Expand Down Expand Up @@ -124,6 +125,7 @@ import axios from '@nextcloud/axios'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import Draggable from 'vuedraggable'
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
import NcUserStatusIcon from '@nextcloud/vue/dist/Components/NcUserStatusIcon.js'
import Pencil from 'vue-material-design-icons/Pencil.vue'
import Vue from 'vue'
Expand All @@ -140,7 +142,6 @@ const statusInfo = {
},
status: {
text: t('dashboard', 'Status'),
icon: 'icon-user-status-online',
},
}
Expand All @@ -152,6 +153,7 @@ export default {
Draggable,
NcModal,
Pencil,
NcUserStatusIcon,
},
mixins: [
isMobile,
Expand Down
2 changes: 1 addition & 1 deletion apps/user_status/css/user-status-menu.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.icon-user-status{background-image:url("../img/app.svg")}.icon-user-status-dark{background-image:url("../img/app-dark.svg")}.icon-user-status-online{background-image:url("../img/user-status-online.svg")}.icon-user-status-away{background-image:url("../img/user-status-away.svg")}.icon-user-status-dnd{background-image:url("../img/user-status-dnd.svg")}.icon-user-status-invisible{background-image:url("../img/user-status-invisible.svg");filter:var(--background-invert-if-dark)}/*# sourceMappingURL=user-status-menu.css.map */
.icon-user-status{background-image:url("../img/app.svg")}.icon-user-status-dark{background-image:url("../img/app-dark.svg")}/*# sourceMappingURL=user-status-menu.css.map */
2 changes: 1 addition & 1 deletion apps/user_status/css/user-status-menu.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions apps/user_status/css/user-status-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,3 @@
background-image: url("../img/app-dark.svg");

}

.icon-user-status-online {
background-image: url('../img/user-status-online.svg');
}

.icon-user-status-away {
background-image: url('../img/user-status-away.svg');
}

.icon-user-status-dnd {
background-image: url('../img/user-status-dnd.svg');
}

.icon-user-status-invisible {
background-image: url('../img/user-status-invisible.svg');
filter: var(--background-invert-if-dark);
}
1 change: 0 additions & 1 deletion apps/user_status/img/user-status-away.svg

This file was deleted.

1 change: 0 additions & 1 deletion apps/user_status/img/user-status-dnd.svg

This file was deleted.

1 change: 0 additions & 1 deletion apps/user_status/img/user-status-invisible.svg

This file was deleted.

1 change: 0 additions & 1 deletion apps/user_status/img/user-status-online.svg

This file was deleted.

11 changes: 8 additions & 3 deletions apps/user_status/src/UserStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@
<button v-if="!inline"
class="user-status-menu-item"
@click.stop="openModal">
<span aria-hidden="true" :class="statusIcon" class="user-status-icon" />
<NcUserStatusIcon class="user-status-icon"
:status="statusType"
aria-hidden="true" />
{{ visibleMessage }}
</button>

<!-- Dashboard Status -->
<NcButton v-else
:icon="statusIcon"
@click.stop="openModal">
<template #icon>
<span aria-hidden="true" :class="statusIcon" class="user-status-icon" />
<NcUserStatusIcon class="user-status-icon"
:status="statusType"
aria-hidden="true" />
</template>
{{ visibleMessage }}
</NcButton>
Expand All @@ -47,6 +50,7 @@
<script>
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcUserStatusIcon from '@nextcloud/vue/dist/Components/NcUserStatusIcon.js'
import debounce from 'debounce'

import { sendHeartbeat } from './services/heartbeatService.js'
Expand All @@ -57,6 +61,7 @@ export default {

components: {
NcButton,
NcUserStatusIcon,
SetStatusModal: () => import(/* webpackChunkName: 'user-status-modal' */'./components/SetStatusModal.vue'),
},
mixins: [OnlineStatusMixin],
Expand Down
18 changes: 10 additions & 8 deletions apps/user_status/src/components/OnlineStatusSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,28 @@
@change="onChange">
<label :for="id" class="user-status-online-select__label">
{{ label }}
<span :class="icon" aria-hidden="true" role="img" />
<NcUserStatusIcon :status="type"
aria-hidden="true" />
<em class="user-status-online-select__subline">{{ subline }}</em>
</label>
</div>
</template>

<script>
import NcUserStatusIcon from '@nextcloud/vue/dist/Components/NcUserStatusIcon.js'

export default {
name: 'OnlineStatusSelect',

components: {
NcUserStatusIcon,
},

props: {
checked: {
type: Boolean,
default: false,
},
icon: {
type: String,
required: true,
},
type: {
type: String,
required: true,
Expand Down Expand Up @@ -101,8 +104,8 @@ $label-padding: 8px;

span {
position: absolute;
top: calc(50% - math.div($icon-size, 2));
left: $label-padding;
top: calc(50% - 10px);
left: 10px;
display: block;
width: $icon-size;
height: $icon-size;
Expand All @@ -123,5 +126,4 @@ $label-padding: 8px;
color: var(--color-text-lighter);
}
}

</style>
25 changes: 0 additions & 25 deletions apps/user_status/src/mixins/OnlineStatusMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,6 @@ export default {

return this.$t('user_status', 'Set status')
},

/**
* The status indicator icon
*
* @return {string | null}
*/
statusIcon() {
switch (this.statusType) {
case 'online':
return 'icon-user-status-online'

case 'away':
case 'busy':
return 'icon-user-status-away'

case 'dnd':
return 'icon-user-status-dnd'

case 'invisible':
case 'offline':
return 'icon-user-status-invisible'
}

return ''
},
},

methods: {
Expand Down
5 changes: 0 additions & 5 deletions apps/user_status/src/services/statusOptionsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,17 @@ const getAllStatusOptions = () => {
return [{
type: 'online',
label: t('user_status', 'Online'),
icon: 'icon-user-status-online',
}, {
type: 'away',
label: t('user_status', 'Away'),
icon: 'icon-user-status-away',
}, {
type: 'dnd',
label: t('user_status', 'Do not disturb'),
subline: t('user_status', 'Mute all notifications'),
icon: 'icon-user-status-dnd',

}, {
type: 'invisible',
label: t('user_status', 'Invisible'),
subline: t('user_status', 'Appear offline'),
icon: 'icon-user-status-invisible',
}]
}

Expand Down
6 changes: 2 additions & 4 deletions core/src/views/UserMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,7 @@ export default {
background-color: var(--color-primary-element);
color: var(--color-primary-element-text);

img,
svg {
img {
filter: var(--primary-invert-if-dark);
}
}
Expand All @@ -261,8 +260,7 @@ export default {
margin-right: 10px;
}

img,
svg {
img {
filter: var(--background-invert-if-dark);
}
}
Expand Down
4 changes: 2 additions & 2 deletions dist/core-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/dashboard-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/dashboard-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/user-status-modal-8299.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/user-status-modal-8299.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/user_status-menu.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/user_status-menu.js.map

Large diffs are not rendered by default.

0 comments on commit 3658380

Please sign in to comment.