Skip to content

Commit

Permalink
fix(a11y forms): better form accessibility
Browse files Browse the repository at this point in the history
add search role or tag
fix type on pages with search (not always form related)
  • Loading branch information
narduin committed Feb 11, 2025
1 parent 54b6f22 commit b0ce262
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 21 deletions.
28 changes: 15 additions & 13 deletions src/components/SearchComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,21 @@ const clear = () => {
</script>

<template>
<DsfrInputGroup
v-if="isFilter"
:id="id"
v-model="selectedQuery"
:label="searchLabel"
class="filter-input"
:label-visible="labelVisible"
:placeholder="!labelVisible ? searchLabel : undefined"
>
<template #before-input>
<VIconCustom name="search-line" class="search-icon" />
</template>
</DsfrInputGroup>
<search v-if="isFilter">
<DsfrInputGroup
:id="id"
v-model="selectedQuery"
:label="searchLabel"
class="filter-input"
type="search"
:label-visible="labelVisible"
:placeholder="!labelVisible ? searchLabel : undefined"
>
<template #before-input>
<VIconCustom name="search-line" class="search-icon" />
</template>
</DsfrInputGroup>
</search>

<DsfrSearchBar
v-else-if="!dropdown.length"
Expand Down
2 changes: 1 addition & 1 deletion src/store/SearchStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const useSearchStore = defineStore('search', {
].map((page) => {
page += 1
return {
label: page,
label: page.toString(),
href: '#',
title: `Page ${page}`
}
Expand Down
1 change: 0 additions & 1 deletion src/views/bouquets/BouquetsListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ watch(
v-model="selectedQuery"
:is-filter="true"
:search-label="`Filtrer les ${topicsName}s`"
:label="`Filtrer les ${topicsName}s`"
:search-endpoint="router.resolve({ name: topicsSlug }).href"
@update:model-value="search"
/>
Expand Down
8 changes: 3 additions & 5 deletions src/views/datasets/DatasetsListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const computeUrlQuery = (
}
}
const onSelectTopic = (topicId: string) => {
const onSelectTopic = (topicId: string | number) => {
router.push({
path: '/datasets',
query: computeUrlQuery({
Expand All @@ -132,7 +132,7 @@ const onSelectTopic = (topicId: string) => {
})
}
const onSelectOrganization = (orgId: string) => {
const onSelectOrganization = (orgId: string | number) => {
router.push({
path: '/datasets',
query: computeUrlQuery({
Expand Down Expand Up @@ -259,14 +259,12 @@ onMounted(() => {
</p>
<div class="fr-col-md-12 fr-mb-2w">
<SearchComponent
id="search-bouquet"
id="search-datasets"
v-model="localQuery"
:is-filter="true"
search-label="Filtrer des données"
label="Filtrer des données"
:search-endpoint="router.resolve({ name: 'datasets' }).href"
@update:model-value="search()"
@search="$emit('search', $event)"
/>
</div>
<div v-if="topicItems" class="fr-col-md-12 fr-mb-2w">
Expand Down
8 changes: 7 additions & 1 deletion vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ export default defineConfig(({ mode }) => {
return {
base: '/',
plugins: [
vue(),
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => ['search'].includes(tag)
}
}
}),
vueDevTools(),
AutoImport({
include: [/\.[tj]sx?$/, /\.vue$/, /\.vue\?vue/],
Expand Down

0 comments on commit b0ce262

Please sign in to comment.