Skip to content

Commit 6b55e74

Browse files
committed
Add id prop to ProjectGroupPicker for labeling
Expose an optional id prop on ProjectGroupPicker and bind it to the internal input. Update usages across dashboard and workspace create/export pages to pass unique ids and restructure markup so labels use for="..." (replacing implicit label-wrapping with explicit labels and container divs). This improves accessibility by ensuring labels are correctly associated with the picker inputs; no functional behavior changes.
1 parent a48e720 commit 6b55e74

6 files changed

Lines changed: 33 additions & 16 deletions

File tree

components/ProjectGroupPicker.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<div class="position-relative project-group-picker" ref="pickerRef" @focusout="onFocusOut">
33
<input
44
v-model="searchText"
5+
:id="props.id"
56
type="text"
67
class="form-select"
78
:disabled="props.disabled"
@@ -88,7 +89,7 @@ import { ref, watch, onMounted, onUnmounted, nextTick } from 'vue'
8889
import { tdeiUserClient } from '~/services/index'
8990
import type { TdeiProjectGroupItem } from '~/types/tdei'
9091
91-
const props = withDefaults(defineProps<{ disabled?: boolean; options?: TdeiProjectGroupItem[] }>(), {
92+
const props = withDefaults(defineProps<{ id?: string; disabled?: boolean; options?: TdeiProjectGroupItem[] }>(), {
9293
disabled: false,
9394
})
9495

pages/dashboard.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
<h2 class="visually-hidden">My Workspaces</h2>
55

66
<label for="ws_project_group_picker">Project Group</label>
7-
<project-group-picker v-model="currentProjectGroup" id="ws_project_group_picker" />
7+
<project-group-picker
8+
id="ws_project_group_picker"
9+
v-model="currentProjectGroup"
10+
/>
811

912
<nuxt-link class="btn btn-primary flex-shrink-0" to="/workspace/create">
1013
<app-icon variant="add" size="24" />

pages/workspace/[id]/export/tdei.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,16 @@
6262
Dataset Name
6363
<input v-model.trim="datasetName" class="form-control" />
6464
</label>
65-
<label class="d-block mt-3">
66-
Project Group
65+
<div class="mt-3">
66+
<label class="d-block" for="export_tdei_project_group">
67+
Project Group
68+
</label>
6769
<project-group-picker
70+
id="export_tdei_project_group"
6871
v-model="workspace.tdeiProjectGroupId"
6972
:options="eligibleProjectGroups"
7073
/>
71-
</label>
74+
</div>
7275
<label class="d-block mt-3">
7376
Service
7477
<service-picker

pages/workspace/create/blank.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111
<input v-model.trim="workspaceTitle" class="form-control" />
1212
</label>
1313

14-
<label class="d-block mb-3">
15-
Project Group
16-
<project-group-picker v-model="projectGroupId" />
17-
</label>
14+
<div class="mb-3">
15+
<label class="d-block" for="create_blank_project_group">
16+
Project Group
17+
</label>
18+
<project-group-picker
19+
id="create_blank_project_group"
20+
v-model="projectGroupId"
21+
/>
22+
</div>
1823

1924
<div>Dataset Type</div>
2025
<dataset-type-radio v-model="datasetType" class="mb-3" />

pages/workspace/create/file.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@
1616
>
1717
</label>
1818

19-
<label class="d-block mb-3">
20-
Project Group
19+
<div class="mb-3">
20+
<label class="d-block" for="create_file_project_group">
21+
Project Group
22+
</label>
2123
<project-group-picker
24+
id="create_file_project_group"
2225
v-model="projectGroupId"
2326
:disabled="context.active"
2427
required
2528
/>
26-
</label>
29+
</div>
2730

2831
<div>Dataset Type</div>
2932
<dataset-type-radio
@@ -109,4 +112,3 @@ async function create() {
109112
}
110113
}
111114
</script>
112-

pages/workspace/create/tdei.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@
2020
>
2121
</label>
2222

23-
<label class="d-block mb-3">
24-
Project Group
23+
<div class="mb-3">
24+
<label class="d-block" for="create_tdei_project_group">
25+
Project Group
26+
</label>
2527
<project-group-picker
28+
id="create_tdei_project_group"
2629
v-model="projectGroupId"
2730
:disabled="context.active"
2831
required
2932
/>
30-
</label>
33+
</div>
3134

3235
<label v-if="!$route.query.tdeiRecordId" class="d-block mb-3">
3336
Dataset

0 commit comments

Comments
 (0)