From b37ea9cd7e5bdd0bd73400b8ced23e2e59e40fda Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Wed, 21 Feb 2024 22:14:44 +0100 Subject: [PATCH] fix(updatenotification): a11y of channel menu Signed-off-by: Grigorii K. Shartsev --- .../src/components/UpdateNotification.vue | 86 +++++-------------- 1 file changed, 20 insertions(+), 66 deletions(-) diff --git a/apps/updatenotification/src/components/UpdateNotification.vue b/apps/updatenotification/src/components/UpdateNotification.vue index 0dc0188cb2cd4..8a91bddca6ca6 100644 --- a/apps/updatenotification/src/components/UpdateNotification.vue +++ b/apps/updatenotification/src/components/UpdateNotification.vue @@ -112,18 +112,16 @@ @@ -274,41 +272,34 @@ export default { icon: 'icon-star', 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, + 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, + value: 'beta', }) - if (this.isNonDefaultChannel) { + if (this.isNonDefaultChannel(this.currentChannel)) { channelList.push({ text: this.currentChannel, icon: 'icon-rename', - active: true, - action: () => {}, + value: this.currentChannel, }) } return channelList }, - isNonDefaultChannel() { - return this.currentChannel !== 'enterprise' && this.currentChannel !== 'stable' && this.currentChannel !== 'beta' - }, - localizedChannelName() { switch (this.currentChannel) { case 'enterprise': @@ -433,16 +424,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'), { @@ -503,46 +494,9 @@ 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; - } - } - } }