Skip to content

Commit

Permalink
Add DisclosureContent
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Jan 11, 2021
1 parent 69a612f commit 6a6293a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
6 changes: 6 additions & 0 deletions packages/components/src/composite/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
/**
* Composite is a component that may contain navigable items represented by
* CompositeItem. It's inspired by the WAI-ARIA Composite Role and implements
* all the keyboard navigation mechanisms to ensure that there's only one
* tab stop for the whole Composite element. This means that it can behave as
* a roving tabindex or aria-activedescendant container.
*
* @see https://reakit.io/docs/composite/
*/
export {
Expand Down
7 changes: 7 additions & 0 deletions packages/components/src/disclosure/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Accessible Disclosure component that controls visibility of a section of
* content. It follows the WAI-ARIA Disclosure Pattern.
*
* @see https://reakit.io/docs/disclosure/
*/
export { DisclosureContent } from 'reakit';
1 change: 1 addition & 0 deletions packages/components/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export { default as Dashicon } from './dashicon';
export { default as DateTimePicker, DatePicker, TimePicker } from './date-time';
export { default as __experimentalDimensionControl } from './dimension-control';
export { default as Disabled } from './disabled';
export { DisclosureContent as __unstableDisclosureContent } from './disclosure';
export { default as Draggable } from './draggable';
export {
default as DropZone,
Expand Down
15 changes: 7 additions & 8 deletions packages/edit-widgets/src/blocks/widget-area/edit/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/**
* External dependencies
*/
import { DisclosureContent } from 'reakit/Disclosure';

/**
* WordPress dependencies
*/
import { useEffect, useState, useCallback, useRef } from '@wordpress/element';
import { useSelect, useDispatch } from '@wordpress/data';
import { EntityProvider } from '@wordpress/core-data';
import { Panel, PanelBody } from '@wordpress/components';
import {
__unstableDisclosureContent,
Panel,
PanelBody,
} from '@wordpress/components';

/**
* Internal dependencies
Expand Down Expand Up @@ -67,15 +66,15 @@ export default function WidgetAreaEdit( {
{ ( { opened } ) => (
// This is required to ensure LegacyWidget blocks are not unmounted when the panel is collapsed.
// Unmounting legacy widgets may have unintended consequences (e.g. TinyMCE not being properly reinitialized)
<DisclosureContent visible={ opened }>
<__unstableDisclosureContent visible={ opened }>
<EntityProvider
kind="root"
type="postType"
id={ `widget-area-${ id }` }
>
<WidgetAreaInnerBlocks />
</EntityProvider>
</DisclosureContent>
</__unstableDisclosureContent>
) }
</PanelBody>
</Panel>
Expand Down

0 comments on commit 6a6293a

Please sign in to comment.