Skip to content

Commit

Permalink
made sure that the ActionSelect'or has correct accessibiltiy tags
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Nov 30, 2023
1 parent dc42420 commit af5969c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
22 changes: 18 additions & 4 deletions src/components/ActionSelect.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<div class="input-group mb-3">
<select ref="select" v-model="model" class="form-select" :disabled="disabled" :required="required">
<select :id="id" ref="select" v-model="model" class="form-select" :disabled="disabled" :required="required">
<option v-for="option in options" :key="option" :value="option.value" :disabled="option.disabled">{{ option.label }}</option>
</select>
<a class="btn btn-outline-primary" :class="{ disabled: actionDisabled }" @click="action()">
<font-awesome-icon :icon="icon" />
</a>
<button class="btn btn-outline-primary" :class="{ disabled: actionDisabled }" :aria-label="actionAriaLabel" @click="action()">
<font-awesome-icon :icon="icon" aria-hidden="true" />
</button>
</div>
</template>

Expand All @@ -20,6 +20,13 @@ export default {
type: Array,
default: () => [],
},
/**
* The id of the form which will be targeted by a <label for=..
*/
id: {
type: String,
required: true,
},
/**
* The value of the select field.
*/
Expand Down Expand Up @@ -51,6 +58,13 @@ export default {
type: Function,
default: () => {},
},
/**
* The aria-label of the action button
*/
actionAriaLabel: {
type: String,
required: true,
},
/**
* Whether the action button is disabled.
* @example true
Expand Down
2 changes: 2 additions & 0 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,8 @@
"Notify Channel": "Notify Channel",
"aboutNotifyChannel": "Notify channel will trigger a desktop or mobile notification for all members of the channel, whether their availability is set to active or away.",
"Uptime Kuma URL": "Uptime Kuma URL",
"setup a new monitor group": "setup a new monitor group",
"openModalTo": "open modal to {0}",
"Icon Emoji": "Icon Emoji",
"signalImportant": "IMPORTANT: You cannot mix groups and numbers in recipients!",
"aboutWebhooks": "More info about Webhooks on: {0}",
Expand Down
6 changes: 5 additions & 1 deletion src/pages/EditMonitor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@
<div class="mb-3">
<label for="docker-host" class="form-label">{{ $t("Docker Host") }}</label>
<ActionSelect
id="docker-host"
:aria-label="$t('openModalTo', $t('Setup Docker Host'))"
v-model="monitor.docker_host"

Check warning on line 296 in src/pages/EditMonitor.vue

View workflow job for this annotation

GitHub Actions / check-linters

Attribute "v-model" should go before ":aria-label"
:options="dockerHostOptionsList"
:disabled="$root.dockerHostList == null || $root.dockerHostList.length === 0"
Expand Down Expand Up @@ -501,8 +503,10 @@

<!-- Parent Monitor -->
<div class="my-3">
<label for="parent" class="form-label">{{ $t("Monitor Group") }}</label>
<label for="monitorGroupSelector" class="form-label">{{ $t("Monitor Group") }}</label>
<ActionSelect
id="monitorGroupSelector"
:aria-label="$t('openModalTo', 'setup a new monitor group')"
v-model="monitor.parent"

Check warning on line 510 in src/pages/EditMonitor.vue

View workflow job for this annotation

GitHub Actions / check-linters

Attribute "v-model" should go before ":aria-label"
:options="parentMonitorOptionsList"
:disabled="sortedGroupMonitorList.length === 0 && draftGroupName == null"
Expand Down

0 comments on commit af5969c

Please sign in to comment.