Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add label in drag and drop button #25606

Merged
merged 1 commit into from
Sep 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/block-editor/src/components/block-mover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { ToolbarGroup, ToolbarItem, Button } from '@wordpress/components';
import { getBlockType } from '@wordpress/blocks';
import { useState } from '@wordpress/element';
import { withSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -39,6 +40,9 @@ function BlockMover( {
return null;
}

const label =
clientIds.length === 1 ? __( 'Drag Block' ) : __( 'Drag Blocks' );
ntsekouras marked this conversation as resolved.
Show resolved Hide resolved

// We emulate a disabled state because forcefully applying the `disabled`
// attribute on the buttons while it has focus causes the screen to change
// to an unfocused state (body as active element) without firing blur on,
Expand All @@ -60,6 +64,7 @@ function BlockMover( {
icon={ dragHandle }
className="block-editor-block-mover__drag-handle"
aria-hidden="true"
label={ label }
// Should not be able to tab to drag handle as this
// button can only be used with a pointer device.
tabIndex="-1"
Expand Down