Skip to content

Commit 4a084bf

Browse files
committed
fixup! ✨(frontend) make delete buttons nvda-accessible
1 parent e6345ce commit 4a084bf

File tree

7 files changed

+66
-104
lines changed

7 files changed

+66
-104
lines changed

src/frontend/apps/impress/src/components/modal/ButtonCloseModal.tsx

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,18 @@ import React from 'react';
33

44
import { Box } from '@/components';
55

6-
type ButtonCloseModalProps = Omit<
7-
ButtonProps,
8-
'children' | 'icon' | 'aria-label' | 'type'
9-
> & {
10-
ariaLabel: string;
11-
};
12-
13-
const ButtonCloseModal = ({
14-
ariaLabel,
15-
disabled = false,
16-
size = 'small',
17-
color = 'primary-text',
18-
...rest
19-
}: ButtonCloseModalProps) => {
6+
const ButtonCloseModal = (props: ButtonProps) => {
207
return (
218
<Button
229
type="button"
23-
aria-label={ariaLabel}
24-
size={size}
25-
color={color}
26-
disabled={disabled}
10+
size="small"
11+
color="primary-text"
2712
icon={
2813
<Box as="span" aria-hidden="true" className="material-icons-filled">
2914
close
3015
</Box>
3116
}
32-
{...rest}
17+
{...props}
3318
/>
3419
);
3520
};

src/frontend/apps/impress/src/components/quick-search/QuickSearchInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const QuickSearchInput = ({
3232
return (
3333
<>
3434
{children}
35-
{separator && <HorizontalSeparator $withPadding={false} />}
35+
{separator && <HorizontalSeparator />}
3636
</>
3737
);
3838
}

src/frontend/apps/impress/src/features/docs/doc-export/components/ModalExport.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export const ModalExport = ({ onClose, doc }: ModalExportProps) => {
173173
{t('Download')}
174174
</Text>
175175
<ButtonCloseModal
176-
ariaLabel={t('Close the download modal')}
176+
aria-label={t('Close the download modal')}
177177
onClick={() => onClose()}
178178
disabled={isExporting}
179179
/>

src/frontend/apps/impress/src/features/docs/doc-management/components/ModalRemoveDoc.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const ModalRemoveDoc = ({
9898
{t('Delete a doc')}
9999
</Text>
100100
<ButtonCloseModal
101-
ariaLabel={t('Close the delete modal')}
101+
aria-label={t('Close the delete modal')}
102102
onClick={() => onClose()}
103103
/>
104104
</Box>

src/frontend/apps/impress/src/features/docs/doc-search/components/DocSearchModal.tsx

Lines changed: 57 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { Modal, ModalSize } from '@openfun/cunningham-react';
2-
import { Command } from 'cmdk';
32
import Image from 'next/image';
43
import { useRouter } from 'next/router';
54
import { useState } from 'react';
65
import { useTranslation } from 'react-i18next';
76
import { useDebouncedCallback } from 'use-debounce';
87

9-
import { Box, Icon } from '@/components';
8+
import { Box } from '@/components';
109
import ButtonCloseModal from '@/components/modal/ButtonCloseModal';
1110
import { QuickSearch } from '@/components/quick-search';
1211
import { Doc, useDocUtils } from '@/docs/doc-management';
@@ -73,90 +72,68 @@ const DocSearchModalGlobal = ({
7372
$justify="space-between"
7473
className="--docs--doc-search-modal"
7574
>
76-
<Box $direction="row" $align="center" $gap="sm">
77-
<Box $flex="1">
78-
<QuickSearch
79-
placeholder={t('Type the name of a document')}
80-
loading={loading}
81-
onFilter={handleInputSearch}
82-
inputContent={
83-
<Box
84-
$direction="row"
85-
$align="center"
86-
$gap="sm"
87-
$padding={{ horizontal: 'base', vertical: 'sm' }}
88-
>
89-
<Icon iconName="search" $variation="600" />
90-
<Box $flex="1">
91-
<Command.Input
92-
aria-label={t('Quick search input')}
93-
onClick={(e) => {
94-
e.stopPropagation();
95-
}}
96-
placeholder={t('Type the name of a document')}
97-
onValueChange={handleInputSearch}
98-
/>
99-
</Box>
100-
<ButtonCloseModal
101-
ariaLabel={t('Close the search modal')}
102-
onClick={modalProps.onClose}
103-
size="small"
104-
color="primary-text"
105-
/>
106-
</Box>
107-
}
108-
>
75+
<Box $position="absolute" $css="top: 12px; right: 12px;">
76+
<ButtonCloseModal
77+
aria-label={t('Close the search modal')}
78+
onClick={modalProps.onClose}
79+
size="small"
80+
color="primary-text"
81+
/>
82+
</Box>
83+
<QuickSearch
84+
placeholder={t('Type the name of a document')}
85+
loading={loading}
86+
onFilter={handleInputSearch}
87+
>
88+
<Box
89+
$padding={{ horizontal: '10px' }}
90+
$height={isDesktop ? '500px' : 'calc(100vh - 68px - 1rem)'}
91+
>
92+
{showFilters && (
93+
<DocSearchFilters
94+
values={filters}
95+
onValuesChange={setFilters}
96+
onReset={handleResetFilters}
97+
/>
98+
)}
99+
{search.length === 0 && (
109100
<Box
110-
$padding={{ horizontal: '10px' }}
111-
$height={isDesktop ? '500px' : 'calc(100vh - 68px - 1rem)'}
101+
$direction="column"
102+
$height="100%"
103+
$align="center"
104+
$justify="center"
112105
>
113-
{showFilters && (
114-
<DocSearchFilters
115-
values={filters}
116-
onValuesChange={setFilters}
117-
onReset={handleResetFilters}
106+
<Image
107+
className="c__image-system-filter"
108+
width={320}
109+
src={EmptySearchIcon}
110+
alt={t('No active search')}
111+
/>
112+
</Box>
113+
)}
114+
{search && (
115+
<>
116+
{target === DocSearchTarget.ALL && (
117+
<DocSearchContent
118+
search={search}
119+
filters={filters}
120+
onSelect={handleSelect}
121+
onLoadingChange={setLoading}
118122
/>
119123
)}
120-
{search.length === 0 && (
121-
<Box
122-
$direction="column"
123-
$height="100%"
124-
$align="center"
125-
$justify="center"
126-
>
127-
<Image
128-
className="c__image-system-filter"
129-
width={320}
130-
src={EmptySearchIcon}
131-
alt={t('No active search')}
132-
/>
133-
</Box>
134-
)}
135-
{search && (
136-
<>
137-
{target === DocSearchTarget.ALL && (
138-
<DocSearchContent
139-
search={search}
140-
filters={filters}
141-
onSelect={handleSelect}
142-
onLoadingChange={setLoading}
143-
/>
144-
)}
145-
{isDocPage && target === DocSearchTarget.CURRENT && (
146-
<DocSearchSubPageContent
147-
search={search}
148-
filters={filters}
149-
onSelect={handleSelect}
150-
onLoadingChange={setLoading}
151-
renderElement={(doc) => <DocSearchItem doc={doc} />}
152-
/>
153-
)}
154-
</>
124+
{isDocPage && target === DocSearchTarget.CURRENT && (
125+
<DocSearchSubPageContent
126+
search={search}
127+
filters={filters}
128+
onSelect={handleSelect}
129+
onLoadingChange={setLoading}
130+
renderElement={(doc) => <DocSearchItem doc={doc} />}
131+
/>
155132
)}
156-
</Box>
157-
</QuickSearch>
133+
</>
134+
)}
158135
</Box>
159-
</Box>
136+
</QuickSearch>
160137
</Box>
161138
</Modal>
162139
);

src/frontend/apps/impress/src/features/docs/doc-share/components/DocShareModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export const DocShareModal = ({ doc, onClose, isRootDoc = true }: Props) => {
142142
<Box $direction="row" $justify="space-between" $align="center">
143143
<Box $align="flex-start">{t('Share the document')}</Box>
144144
<ButtonCloseModal
145-
ariaLabel={t('Close the share modal')}
145+
aria-label={t('Close the share modal')}
146146
onClick={onClose}
147147
/>
148148
</Box>

src/frontend/apps/impress/src/features/docs/doc-versioning/components/ModalSelectVersion.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const ModalSelectVersion = ({
116116
{t('History')}
117117
</Text>
118118
<ButtonCloseModal
119-
ariaLabel={t('Close the version history modal')}
119+
aria-label={t('Close the version history modal')}
120120
onClick={onClose}
121121
size="nano"
122122
/>

0 commit comments

Comments
 (0)