diff --git a/CHANGELOG.md b/CHANGELOG.md index d66a7a33bc6..72d990adb47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## [`master`](https://github.com/elastic/eui/tree/master) +- Deprecated `EuiKeyboardAccessible` ([4135]https://github.com/elastic/eui/pull/4135) +- Refactored `EuiStep`, `EuiHorizontalSteps`, and `EuiCodeEditor` for better accessibility ([4135]https://github.com/elastic/eui/pull/4135) - Added `minWidth` prop to `EuiButton` ([4056](https://github.com/elastic/eui/pull/4056)) - Added `isSelected` prop to easily turn `EuiButton`, `EuiButtonEmpty`, and `EuiButtonIcon` into toggle buttons ([4056](https://github.com/elastic/eui/pull/4056)) - Updated `EuiButtonGroup` props and render for better accessibility ([4056](https://github.com/elastic/eui/pull/4056)) diff --git a/src-docs/src/views/accessibility/accessibility_example.js b/src-docs/src/views/accessibility/accessibility_example.js index 528af5e3d2c..818e8a51272 100644 --- a/src-docs/src/views/accessibility/accessibility_example.js +++ b/src-docs/src/views/accessibility/accessibility_example.js @@ -5,6 +5,8 @@ import { renderToHtml } from '../../services'; import { GuideSectionTypes } from '../../components'; import { + EuiBadge, + EuiSpacer, EuiCallOut, EuiCode, EuiLink, @@ -65,12 +67,38 @@ export const AccessibilityExample = { }, ], text: ( -

- You can make interactive elements keyboard-accessible with the{' '} - EuiKeyboardAccessible component. This is necessary - for non-button elements and a tags without{' '} - href attributes. -

+ <> + + Set for deprecation. See details. + + + + + +

+ Though this component solved some problems for keyboard-only users + it also frequently introduced problems for screen reader users. As + such, we don't recommend it's continued use. +

+
+ + + +

+ You can make interactive elements keyboard-accessible with the{' '} + EuiKeyboardAccessible component. This is necessary + for non-button elements and a tags without{' '} + href attributes. +

+ ), props: { EuiKeyboardAccessible }, snippet: keyboardAccessibleSnippet, diff --git a/src-docs/src/views/steps/steps_horizontal.js b/src-docs/src/views/steps/steps_horizontal.js index 1b21ecda31d..38a842b4f9b 100644 --- a/src-docs/src/views/steps/steps_horizontal.js +++ b/src-docs/src/views/steps/steps_horizontal.js @@ -24,8 +24,4 @@ const horizontalSteps = [ }, ]; -export default () => ( -
- -
-); +export default () => ; diff --git a/src/components/code_editor/__snapshots__/code_editor.test.tsx.snap b/src/components/code_editor/__snapshots__/code_editor.test.tsx.snap index bb4c16c2d92..3c3df517895 100644 --- a/src/components/code_editor/__snapshots__/code_editor.test.tsx.snap +++ b/src/components/code_editor/__snapshots__/code_editor.test.tsx.snap @@ -1,12 +1,10 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`EuiCodeEditor behavior hint element should be disabled when the ui ace box gains focus 1`] = ` -

When you're done, press Escape to stop editing.

-
+ `; exports[`EuiCodeEditor behavior hint element should be enabled when the ui ace box loses focus 1`] = ` -

When you're done, press Escape to stop editing.

-
+ `; exports[`EuiCodeEditor behavior hint element should be tabable 1`] = ` -

When you're done, press Escape to stop editing.

-
+ `; exports[`EuiCodeEditor is rendered 1`] = ` @@ -68,12 +62,10 @@ exports[`EuiCodeEditor is rendered 1`] = ` class="euiCodeEditorWrapper" data-test-subj="test subject string" > -

When you're done, press Escape to stop editing.

-
+
-

When you're done, press Escape to stop editing.

-
+
-

When you're done, press Escape to stop editing.

-
+
-

When you're done, press Escape to stop interacting with the code.

-
+
-

When you're done, press Escape to stop editing.

-
+
{ if (aceEditor) { @@ -154,13 +154,6 @@ export class EuiCodeEditor extends Component< } }; - onKeyDownHint: KeyboardEventHandler = (event) => { - if (event.key === keys.ENTER) { - event.preventDefault(); - this.startEditing(); - } - }; - startEditing = () => { this.setState({ isHintActive: false, @@ -256,18 +249,14 @@ export class EuiCodeEditor extends Component< filteredCursorStart = cursorStart; } - // Don't use EuiKeyboardAccessible here because it doesn't play nicely with onKeyDown. const prompt = ( -
{ this.editorHint = hint; }} - tabIndex={0} - role="button" onClick={this.startEditing} - onKeyDown={this.onKeyDownHint} data-test-subj="codeEditorHint">

{isReadOnly ? ( @@ -296,7 +285,7 @@ export class EuiCodeEditor extends Component< /> )}

-
+ ); return ( diff --git a/src/components/steps/__snapshots__/step.test.tsx.snap b/src/components/steps/__snapshots__/step.test.tsx.snap index e4d3691745c..925c3dc5fdd 100644 --- a/src/components/steps/__snapshots__/step.test.tsx.snap +++ b/src/components/steps/__snapshots__/step.test.tsx.snap @@ -9,12 +9,20 @@ exports[`EuiStep is rendered 1`] = `
-
- 1 -
+ + Step 1 + + +

@@ -38,12 +46,20 @@ exports[`EuiStep props headingElement 1`] = `

-
- 1 -
+ + Step 1 + + +

@@ -67,16 +83,15 @@ exports[`EuiStep props status complete is rendered 1`] = `
-
-
+

@@ -100,16 +115,15 @@ exports[`EuiStep props status danger is rendered 1`] = `

-
-
+

@@ -133,12 +147,20 @@ exports[`EuiStep props status disabled is rendered 1`] = `

-
- 1 -
+ + Step 1 is disabled + + +

@@ -162,10 +184,15 @@ exports[`EuiStep props status incomplete is rendered 1`] = `

-
+ > + + Step 1 is incomplete + +

@@ -189,16 +216,15 @@ exports[`EuiStep props status warning is rendered 1`] = `

-
-
+

@@ -222,12 +248,20 @@ exports[`EuiStep props step 1`] = `

-
- 5 -
+ + Step 5 + + +

@@ -251,12 +285,20 @@ exports[`EuiStep props titleSize 1`] = `

-
- 1 -
+ + Step 1 + + +

diff --git a/src/components/steps/__snapshots__/step_horizontal.test.tsx.snap b/src/components/steps/__snapshots__/step_horizontal.test.tsx.snap index d97b08a18d7..8b5a687edcc 100644 --- a/src/components/steps/__snapshots__/step_horizontal.test.tsx.snap +++ b/src/components/steps/__snapshots__/step_horizontal.test.tsx.snap @@ -1,271 +1,235 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`EuiStepHorizontal is rendered 1`] = ` -