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

Make accessible toolbar stable and deprecate old usage #23316

Merged
merged 28 commits into from
Aug 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
fc54ccd
Deprecate legacy toolbar usage
diegohaz Jun 19, 2020
e29ae96
Update e2e tests
diegohaz Jun 19, 2020
867543d
Merge branch 'master' into try/accessible-toolbar
diegohaz Jul 13, 2020
b40177f
Merge branch 'master' into try/accessible-toolbar
diegohaz Jul 16, 2020
d5201eb
Remove __experimental flag from Toolbar accessibilityLabel prop
diegohaz Jul 16, 2020
ac60181
Merge branch 'master' into try/accessible-toolbar
diegohaz Jul 20, 2020
fde5aa1
Merge branch 'master' into try/accessible-toolbar
diegohaz Jul 23, 2020
7aecd5e
Use label instead of accessibilityLabel
diegohaz Jul 23, 2020
94d5ca2
Deprecate <Toolbar> without label prop
diegohaz Jul 23, 2020
26dda7e
Make ToolbarItem component stable
diegohaz Jul 23, 2020
5efe0db
Deprecate ToolbarButton usage without a parent Toolbar
diegohaz Jul 23, 2020
f48467e
Simplify jsdocs
diegohaz Jul 23, 2020
b464950
data-experimental-toolbar-item to data-toolbar-item
diegohaz Jul 23, 2020
1813a7d
Remove deprecation warning from ToolbarButton
diegohaz Jul 23, 2020
e16144a
Update unit test
diegohaz Jul 23, 2020
e387239
Update Toolbar README
diegohaz Jul 23, 2020
696279d
Update tests
diegohaz Jul 23, 2020
cf740b4
Remove ToolbarGroup test from Toolbar
diegohaz Jul 23, 2020
c184881
Merge branch 'master' into try/accessible-toolbar
diegohaz Jul 28, 2020
dff1660
Replace Toolbar by ToolbarGroup on the Classic Editor
diegohaz Jul 28, 2020
dbc4da3
Merge branch 'master' into try/accessible-toolbar
diegohaz Aug 6, 2020
2b5d232
Add Toolbar, ToolbarButton, ToolbarGroup and ToolbarItem docs
diegohaz Aug 6, 2020
5931985
Add links to depreaction notices and warnings
diegohaz Aug 6, 2020
cf8483d
Update ToolbarButton docs
diegohaz Aug 6, 2020
df663c6
Improve documentation around BlockControls usage
diegohaz Aug 10, 2020
dd7ead5
Update deprecation warning link on Navigable Toolbar
diegohaz Aug 10, 2020
e177fb1
Update ToolbarItem README
diegohaz Aug 10, 2020
c0acb82
Update ToolbarItem README
diegohaz Aug 10, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ function useIsAccessibleToolbar( ref ) {
if ( ! onlyToolbarItem ) {
deprecated( 'Using custom components as toolbar controls', {
diegohaz marked this conversation as resolved.
Show resolved Hide resolved
alternative: 'ToolbarItem or ToolbarButton components',
link:
'https://developer.wordpress.org/block-editor/components/toolbar-button/',
} );
}
setIsAccessibleToolbar( onlyToolbarItem );
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/toolbar-button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ function MyToolbar() {
}
```

### Inside BlockControls

If you're working on a custom block and you want to add controls to the block toolbar, you should use [BlockControls](/docs/designers-developers/developers/tutorials/block-tutorial/block-controls-toolbar-and-sidebar.md) instead. Optinally wrapping it with [ToolbarGroup](/packages/components/src/toolbar-group/README.md).

```jsx
Expand Down
22 changes: 21 additions & 1 deletion packages/components/src/toolbar-item/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ToolbarItem

A ToolbarItem is a generic headless component that can be used to make any custom component a [Toolbar](/packages/components/src/toolbar/README.md) item.
A ToolbarItem is a generic headless component that can be used to make any custom component a [Toolbar](/packages/components/src/toolbar/README.md) item. It should be inside a [Toolbar](/packages/components/src/toolbar/README.md) or [ToolbarGroup](/packages/components/src/toolbar-group/README.md) when used to create general interfaces. If you're using it to add controls to your custom block, you should consider using [BlockControls](/docs/designers-developers/developers/tutorials/block-tutorial/block-controls-toolbar-and-sidebar.md).

## Usage

Expand Down Expand Up @@ -47,6 +47,26 @@ function MyToolbar() {
}
```

### Inside BlockControls

If you're working on a custom block and you want to add controls to the block toolbar, you should use [BlockControls](/docs/designers-developers/developers/tutorials/block-tutorial/block-controls-toolbar-and-sidebar.md) instead. Optinally wrapping it with [ToolbarGroup](/packages/components/src/toolbar-group/README.md).

```jsx
import { BlockControls } from '@wordpress/block-editor';
import { Toolbar, ToolbarGroup, ToolbarItem, Button } from '@wordpress/components';
import { edit } from '@wordpress/icons';
diegohaz marked this conversation as resolved.
Show resolved Hide resolved

function Edit() {
return (
<BlockControls>
<ToolbarGroup>
<ToolbarItem as={ Button }>I am a toolbar button</ToolbarItem>
</ToolbarGroup>
</BlockControls>
);
}
```

## Related components

* ToolbarItem should be used inside [Toolbar](/packages/components/src/toolbar/README.md) or [ToolbarGroup](/packages/components/src/toolbar-group/README.md).
Expand Down