From 571fe7ad0a7c663ca00c24c6d841095ecbc0f32c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Zieli=C5=84ski?= Date: Mon, 16 Mar 2020 14:16:09 +0100 Subject: [PATCH] Use as="" instead of wrapping elements with screen-reader-text class --- .../src/components/block-navigation/list.js | 2 +- .../test/__snapshots__/index.js.snap | 2 +- .../responsive-block-control/label.js | 2 +- .../test/__snapshots__/index.js.snap | 2 +- .../embed/test/__snapshots__/index.js.snap | 4 +-- .../components/src/color-picker/inputs.js | 4 +-- .../custom-gradient-picker/control-points.js | 2 +- .../src/custom-select-control/index.js | 23 ++++++--------- .../components/src/external-link/index.js | 2 +- .../components/post-preview-button/index.js | 2 +- .../test/__snapshots__/index.js.snap | 8 ++++-- storybook/test/__snapshots__/index.js.snap | 28 ++++++++----------- 12 files changed, 37 insertions(+), 44 deletions(-) diff --git a/packages/block-editor/src/components/block-navigation/list.js b/packages/block-editor/src/components/block-navigation/list.js index 993ba1272a397a..55a1b28848b9dd 100644 --- a/packages/block-editor/src/components/block-navigation/list.js +++ b/packages/block-editor/src/components/block-navigation/list.js @@ -58,7 +58,7 @@ export default function BlockNavigationList( { { getBlockLabel( blockType, block.attributes ) } { isSelected && ( - + { __( '(selected block)' ) } ) } diff --git a/packages/block-editor/src/components/link-control/test/__snapshots__/index.js.snap b/packages/block-editor/src/components/link-control/test/__snapshots__/index.js.snap index 40cef307d514ce..857f93071f8b04 100644 --- a/packages/block-editor/src/components/link-control/test/__snapshots__/index.js.snap +++ b/packages/block-editor/src/components/link-control/test/__snapshots__/index.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Basic rendering should render 1`] = `""`; +exports[`Basic rendering should render 1`] = `""`; diff --git a/packages/block-editor/src/components/responsive-block-control/label.js b/packages/block-editor/src/components/responsive-block-control/label.js index 84a92bb337b92c..f1445c0872df70 100644 --- a/packages/block-editor/src/components/responsive-block-control/label.js +++ b/packages/block-editor/src/components/responsive-block-control/label.js @@ -27,7 +27,7 @@ export default function ResponsiveBlockControlLabel( { { viewport.label } - + { accessibleLabel } diff --git a/packages/block-editor/src/components/responsive-block-control/test/__snapshots__/index.js.snap b/packages/block-editor/src/components/responsive-block-control/test/__snapshots__/index.js.snap index fc1b0a65e95a14..a5e0beb316a347 100644 --- a/packages/block-editor/src/components/responsive-block-control/test/__snapshots__/index.js.snap +++ b/packages/block-editor/src/components/responsive-block-control/test/__snapshots__/index.js.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Basic rendering should render with required props 1`] = `"
Padding

Toggle between using the same value for all screen sizes or using a unique value per screen size.

All is used here for testing purposes to ensure we have access to details about the device.

"`; +exports[`Basic rendering should render with required props 1`] = `"
Padding

Toggle between using the same value for all screen sizes or using a unique value per screen size.

All is used here for testing purposes to ensure we have access to details about the device.

"`; diff --git a/packages/block-library/src/embed/test/__snapshots__/index.js.snap b/packages/block-library/src/embed/test/__snapshots__/index.js.snap index 4d0859d949d2ce..cd54f37827706f 100644 --- a/packages/block-library/src/embed/test/__snapshots__/index.js.snap +++ b/packages/block-library/src/embed/test/__snapshots__/index.js.snap @@ -60,11 +60,11 @@ exports[`core/embed block edit matches snapshot 1`] = ` target="_blank" > Learn more about embeds -
(opens in a new tab) -
+
- + { __( 'Use your left or right arrow keys or drag and drop with the mouse to change the gradient position. Press the button to change the color or remove the control point.' ) } diff --git a/packages/components/src/custom-select-control/index.js b/packages/components/src/custom-select-control/index.js index c4b1badb2b983b..f12f79cc23e1f6 100644 --- a/packages/components/src/custom-select-control/index.js +++ b/packages/components/src/custom-select-control/index.js @@ -91,18 +91,6 @@ export default function CustomSelectControl( { ) { delete menuProps[ 'aria-activedescendant' ]; } - - const labelElem = ( - /* eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for */ - - ); - return (
{ hideLabelFromVision ? ( - { labelElem } + { label } ) : ( - labelElem + /* eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for */ + ) }