Skip to content

Commit f2d80bb

Browse files
Arthurgcornut
authored andcommitted
fix(dialog): fix section region with header and footer
Remove tags roles to avoid confusion for the screen readers
1 parent 3c80feb commit f2d80bb

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Fixed
1111

1212
- `UserBlock`: fix fields wrapping in horizontal mode.
13+
- `Dialog`: fixed dialog `section` layout to avoid the `role=dialog` overriding the section role and breaking the link with the `header` and `footer`.
1314

1415
### Added
1516

packages/lumx-react/src/components/dialog/Dialog.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -214,18 +214,13 @@ export const Dialog = forwardRef<DialogProps, HTMLDivElement>((props, ref) => {
214214

215215
<HeadingLevelProvider level={2}>
216216
<ThemeProvider value={undefined}>
217-
<section
218-
className={`${CLASSNAME}__container`}
219-
role="dialog"
220-
aria-modal="true"
221-
{...dialogProps}
222-
>
217+
<div className={`${CLASSNAME}__container`} role="dialog" aria-modal="true" {...dialogProps}>
223218
<ClickAwayProvider
224219
callback={!shouldPreventCloseOnClickAway && onClose}
225220
childrenRefs={clickAwayRefs}
226221
parentRef={rootRef}
227222
>
228-
<div className={`${CLASSNAME}__wrapper`} ref={wrapperRef}>
223+
<section className={`${CLASSNAME}__wrapper`} ref={wrapperRef}>
229224
{(header || headerChildContent) && (
230225
<header
231226
{...headerChildProps}
@@ -278,9 +273,9 @@ export const Dialog = forwardRef<DialogProps, HTMLDivElement>((props, ref) => {
278273
<Progress variant={ProgressVariant.circular} />
279274
</div>
280275
)}
281-
</div>
276+
</section>
282277
</ClickAwayProvider>
283-
</section>
278+
</div>
284279
</ThemeProvider>
285280
</HeadingLevelProvider>
286281
</div>,

0 commit comments

Comments
 (0)