Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(updatenotification): a11y of channel menu and new icons #43746

Merged
merged 4 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 46 additions & 80 deletions apps/updatenotification/src/components/UpdateNotification.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@
</template>
<template v-else>
{{ t('updatenotification', 'Your version is up to date.') }}
<a :title="lastCheckedOnString" :aria-label="lastCheckedOnString" href="https://nextcloud.com/changelog/" class="icon-info details" target="_blank"></a>
<a :title="lastCheckedOnString"
:aria-label="lastCheckedOnString"
href="https://nextcloud.com/changelog/"
class="icon-info details"
target="_blank" />
</template>

<template v-if="!isDefaultUpdateServerURL">
Expand All @@ -108,18 +112,18 @@
<IconChevronDown :size="20" />
</template>
<template #default>
<!-- TODO use NcActionRadio if it provides long text, e.g. subtitle -->
<NcActionButton v-for="channel,index in channelList"
:key="index"
:aria-checked="channel.active ? 'true' : 'false'"
:aria-label="channel.text"
:disabled="!!channel.disabled"
:icon="channel.icon"
<NcActionButton v-for="channel in channelList"
:key="channel.value"
:disabled="channel.disabled"
:name="channel.text"
class="update-channel-action"
:value="channel.value"
:model-value="currentChannel"
type="radio"
close-after-click
role="menuitemradio"
@click="channel.action">
@update:modelValue="changeReleaseChannel">
<template #icon>
<component :is="channel.icon" :size="20" />
</template>
{{ channel.longtext }}
</NcActionButton>
</template>
Expand All @@ -131,8 +135,8 @@
<em v-html="noteDelayedStableString" />
</p>

<NcSelect v-model="notifyGroups"
id="notify-members-settings-select-wrapper"
<NcSelect id="notify-members-settings-select-wrapper"
v-model="notifyGroups"
:input-label="t('updatenotification', 'Notify members of the following groups about available updates:')"
:options="groups"
:multiple="true"
Expand Down Expand Up @@ -167,8 +171,14 @@ import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
import NcSelect from '@nextcloud/vue/dist/Components/NcSelect.js'
import NcSettingsSection from '@nextcloud/vue/dist/Components/NcSettingsSection.js'
import IconChevronDown from 'vue-material-design-icons/ChevronDown.vue'
import IconCloudCheckVariant from 'vue-material-design-icons/CloudCheckVariant.vue'
import IconLink from 'vue-material-design-icons/Link.vue'
import IconNewBox from 'vue-material-design-icons/NewBox.vue'
import IconPencil from 'vue-material-design-icons/Pencil.vue'
import IconSourceBranch from 'vue-material-design-icons/SourceBranch.vue'
import IconStar from 'vue-material-design-icons/Star.vue'
import IconWeatherNight from 'vue-material-design-icons/WeatherNight.vue'
import IconWrench from 'vue-material-design-icons/Wrench.vue'
import debounce from 'debounce'

const logger = getLoggerBuilder()
Expand All @@ -190,6 +200,7 @@ export default {
NcSelect,
NcSettingsSection,
},

data() {
return {
loadingGroups: false,
Expand Down Expand Up @@ -267,44 +278,41 @@ export default {
channelList.push({
text: t('updatenotification', 'Enterprise'),
longtext: t('updatenotification', 'For enterprise use. Provides always the latest patch level, but will not update to the next major release immediately. That update happens once Nextcloud GmbH has done additional hardening and testing for large-scale and mission-critical deployments. This channel is only available to customers and provides the Nextcloud Enterprise package.'),
icon: 'icon-star',
icon: IconStar,
active: this.currentChannel === 'enterprise',
disabled: !this.hasValidSubscription,
action: this.changeReleaseChannelToEnterprise,
value: 'enterprise',
})

channelList.push({
text: t('updatenotification', 'Stable'),
longtext: t('updatenotification', 'The most recent stable version. It is suited for regular use and will always update to the latest major version.'),
icon: 'icon-checkmark',
active: this.currentChannel === 'stable',
action: this.changeReleaseChannelToStable,
icon: IconCloudCheckVariant,
value: 'stable',
})

channelList.push({
text: t('updatenotification', 'Beta'),
longtext: t('updatenotification', 'A pre-release version only for testing new features, not for production environments.'),
icon: 'icon-category-customization',
active: this.currentChannel === 'beta',
action: this.changeReleaseChannelToBeta,
icon: IconWrench,
value: 'beta',
})

if (this.isNonDefaultChannel) {
if (this.isNonDefaultChannel(this.currentChannel)) {
const nonDefaultIcons = {
daily: IconWeatherNight,
git: IconSourceBranch,
}
channelList.push({
text: this.currentChannel,
icon: 'icon-rename',
active: true,
action: () => {},
icon: nonDefaultIcons[this.currentChannel] || IconPencil,
value: this.currentChannel,
})
}

return channelList
},

isNonDefaultChannel() {
return this.currentChannel !== 'enterprise' && this.currentChannel !== 'stable' && this.currentChannel !== 'beta'
},

localizedChannelName() {
switch (this.currentChannel) {
case 'enterprise':
Expand All @@ -320,7 +328,7 @@ export default {
},

watch: {
notifyGroups(selectedOptions) {
notifyGroups() {
if (!this.enableChangeWatcher) {
// The first time is when loading the app
this.enableChangeWatcher = true
Expand Down Expand Up @@ -429,16 +437,16 @@ export default {
form.submit()
})
},
changeReleaseChannelToEnterprise() {
this.changeReleaseChannel('enterprise')
},
changeReleaseChannelToStable() {
this.changeReleaseChannel('stable')
},
changeReleaseChannelToBeta() {
this.changeReleaseChannel('beta')

isNonDefaultChannel(channel) {
return !['enterprise', 'stable', 'beta'].includes(channel)
},

changeReleaseChannel(channel) {
if (this.isNonDefaultChannel(channel)) {
return
}

this.currentChannel = channel

axios.post(generateUrl('/apps/updatenotification/channel'), {
Expand Down Expand Up @@ -499,52 +507,10 @@ export default {
.applist {
margin-bottom: 25px;
}

.update-menu {
position: relative;
cursor: pointer;
margin-left: 3px;
display: inline-block;
padding: 10px;
border-radius: 10px;
border: 2px solid var(--color-border-dark);
.icon-update-menu {
cursor: inherit;
.icon-triangle-s {
display: inline-block;
vertical-align: middle;
cursor: inherit;
opacity: 1;
}
}
}
}
</style>
<style lang="scss">
// Make current selected update channel visually visible, remove if NcActionRadio is used
.update-channel-action[aria-checked=true] {
border-inline-start: 4px solid var(--color-primary-element);

&:hover, &:focus-within {
background-color: var(--color-primary-element-light-hover);
}

button {
background-color: var(--color-primary-element-light);
color: var(--color-primary-element-light-text);
}
}
// Ensure outline for focus-visible works even with background color of selected channel
.update-channel-action[aria-checked] {
margin-block: 2px;
}

#updatenotification {
/* override needed to replace yellow hover state with a dark one */
.update-menu .icon-star:hover,
.update-menu .icon-star:focus {
background-image: var(--icon-starred);
}
/* override NcSelect styling so that label can have correct width */
#notify-members-settings-select-wrapper {
width: fit-content;
Expand Down
4 changes: 2 additions & 2 deletions dist/core-common.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files-sidebar.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-sidebar.js.map

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/weather_status-weather-status.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/weather_status-weather-status.js.map

Large diffs are not rendered by default.

Loading