From 4a868288574ac1002ec6d084d53262126d9c9a82 Mon Sep 17 00:00:00 2001 From: miukimiu Date: Thu, 5 Mar 2020 19:16:37 +0000 Subject: [PATCH 1/3] Removing fieldset and replacing by div role group --- .../described_form_group.test.tsx.snap | 990 ++++++++---------- .../described_form_group.tsx | 44 +- 2 files changed, 473 insertions(+), 561 deletions(-) diff --git a/src/components/form/described_form_group/__snapshots__/described_form_group.test.tsx.snap b/src/components/form/described_form_group/__snapshots__/described_form_group.test.tsx.snap index ab5e77d8b1a..77f97ad1b28 100644 --- a/src/components/form/described_form_group/__snapshots__/described_form_group.test.tsx.snap +++ b/src/components/form/described_form_group/__snapshots__/described_form_group.test.tsx.snap @@ -12,100 +12,88 @@ exports[`EuiDescribedFormGroup is rendered 1`] = ` } > - -
+ - - - Title - - - -
- -
+
+ - - - - -
+ + +
+ - -
- Test description -
-
-
-
-
- - + +
+ +
+
+ +
-
-
-
- -
+
-
-
- -
- -
-
+ + + + + + + `; @@ -120,80 +108,68 @@ exports[`EuiDescribedFormGroup props description is not rendered when it's not p } > - -
+ - - - Title - - - -
- -
+
+ - - - -
- - + Title + + +
+
+ +
-
-
-
- -
+
-
-
- -
- -
-
+ + + + + + + `; @@ -210,100 +186,88 @@ exports[`EuiDescribedFormGroup props fullWidth is rendered 1`] = ` } > - -
+ - - - Title - - - -
- -
+
+ - - - - -
+ + +
+ - -
- Test description -
-
-
-
-
- - + +
+ +
+
+ +
-
-
-
- -
+
-
-
- -
- -
-
+ + + + + + + `; @@ -320,100 +284,88 @@ exports[`EuiDescribedFormGroup props gutterSize is rendered 1`] = ` } > - -
+ - - - Title - - - -
- -
+
+ - - - - -
+ + +
+ - -
- Test description -
-
-
-
-
- - + +
+ +
+
+ +
-
-
-
- -
+
-
-
- -
- -
-
+ + + + + + + `; @@ -430,100 +382,88 @@ exports[`EuiDescribedFormGroup props titleSize is rendered 1`] = ` } titleSize="l" > - -
+ - - - Title - - - -
- -
+
+ - - - - -
+ + +
+ - -
- Test description -
-
-
-
-
- - + +
+ +
+
+ +
-
-
-
- -
+
-
-
- -
- -
-
+ + + + + + + `; @@ -539,166 +479,154 @@ exports[`EuiDescribedFormGroup ties together parts for accessibility 1`] = ` } > - -
+ - - - Title - - - -
- -
+
+ - - - - -
+ + +
+ - -
- Test description -
-
-
-
-
- - + +
+ +
+
+ +
-
-
-
- - - -
-
+ +
+
+ + - - -
- Error one -
-
- + + +
-
- Error two -
- - + + +
-
- Help text -
- -
+ Help text +
+
- -
- -
- -
-
+ + + + + + + `; diff --git a/src/components/form/described_form_group/described_form_group.tsx b/src/components/form/described_form_group/described_form_group.tsx index ae5b8a558af..23f065d8365 100644 --- a/src/components/form/described_form_group/described_form_group.tsx +++ b/src/components/form/described_form_group/described_form_group.tsx @@ -8,9 +8,6 @@ import { EuiTitle, EuiTitleSize, EuiTitleProps } from '../../title'; import { EuiText } from '../../text'; import { EuiFlexGroup, EuiFlexItem, EuiFlexGroupGutterSize } from '../../flex'; -import { EuiScreenReaderOnly } from '../../accessibility'; -import { EuiInnerText } from '../../inner_text'; - const paddingSizeToClassNameMap = { xxxs: 'euiDescribedFormGroup__fieldPadding--xxxsmall', xxs: 'euiDescribedFormGroup__fieldPadding--xxsmall', @@ -25,7 +22,7 @@ export const PADDING_SIZES = keysOf(paddingSizeToClassNameMap); export type EuiDescribedFormGroupPaddingSize = keyof typeof paddingSizeToClassNameMap; export type EuiDescribedFormGroupProps = CommonProps & - Omit, 'title'> & { + Omit, 'title'> & { /** * One or more `EuiFormRow`s */ @@ -85,31 +82,18 @@ export const EuiDescribedFormGroup: React.FunctionComponent< } return ( - - {(ref, innerText) => ( -
- - {innerText} - - - - - - - - - {renderedDescription} - - - {children} - -
- )} -
+
+ + + + {title} + + + {renderedDescription} + + + {children} + +
); }; From 586d5c383dfff45c7d0d5e4e03a3f58996e25bf6 Mon Sep 17 00:00:00 2001 From: miukimiu Date: Thu, 5 Mar 2020 19:49:08 +0000 Subject: [PATCH 2/3] Adding changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4b18e24370..390bc24f98d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Added `sections` and `position` props to `EuiHeader` ([#2928](https://github.com/elastic/eui/pull/2928)) - Added `gutterSize` prop to `EuiListGroup` ([#2980](https://github.com/elastic/eui/pull/2980)) - Added `color` prop to `EuiListGroupItem` and updated size style ([#2980](https://github.com/elastic/eui/pull/2980)) +- Improved `EuiDescribedFormGroup` a11y by allowing the `EuiTitle` to be visible to accessibility tools ([#2989](https://github.com/elastic/eui/pull/2989)) **Bug Fixes** From 91891ea4f115a5bb5014542698db3b2eb728f571 Mon Sep 17 00:00:00 2001 From: miukimiu Date: Mon, 9 Mar 2020 16:37:25 +0000 Subject: [PATCH 3/3] Moving changelog description into bug fixes --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98c48d64037..c55059a96cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,6 @@ - Added `sections` and `position` props to `EuiHeader` ([#2928](https://github.com/elastic/eui/pull/2928)) - Added `gutterSize` prop to `EuiListGroup` ([#2980](https://github.com/elastic/eui/pull/2980)) - Added `color` prop to `EuiListGroupItem` and updated size style ([#2980](https://github.com/elastic/eui/pull/2980)) -- Improved `EuiDescribedFormGroup` a11y by allowing the `EuiTitle` to be visible to accessibility tools ([#2989](https://github.com/elastic/eui/pull/2989)) **Bug Fixes** @@ -17,6 +16,7 @@ - Fixed `EuiButton` and other textual components' disabled contrast ([#2874](https://github.com/elastic/eui/pull/2874)) - Fixed z-index conflict with cell popovers in `EuiDataGrid` while in full screen mode ([#2959](https://github.com/elastic/eui/pull/2959)) - Adjusted the header on `EuiDataGrid` to fix to the top within constrained containers and full screen mode ([#2959](https://github.com/elastic/eui/pull/2959)) +- Refactored `EuiDescribedFormGroup` to allow the content inside the `EuiTitle` to be accessible to screen reader users ([#2989](https://github.com/elastic/eui/pull/2989)) **Breaking changes**