Skip to content

Commit

Permalink
Handle item ref in consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
mirka committed May 17, 2023
1 parent d01d543 commit 2386400
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 0 additions & 2 deletions packages/components/src/tab-panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ const UnforwardedTabPanel = (
orientation = 'horizontal',
activeClass = 'is-active',
onSelect,
itemRef,
}: WordPressComponentProps< TabPanelProps, 'div', false >,
ref: ForwardedRef< any >
) => {
Expand Down Expand Up @@ -196,7 +195,6 @@ const UnforwardedTabPanel = (
role="tabpanel"
id={ `${ selectedId }-view` }
className="components-tab-panel__tab-content"
ref={ itemRef || undefined }
>
{ children( selectedTab ) }
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ export default function ListViewSidebar() {
// This ref refers to the list view application area.
const listViewRef = useRef();

const listViewContainerRef = useMergeRefs( [
contentFocusReturnRef,
focusOnMountRef,
listViewRef,
] );

/*
* Callback function to handle list view or outline focus.
*
Expand Down Expand Up @@ -113,11 +119,6 @@ export default function ListViewSidebar() {
<TabPanel
ref={ tabPanelRef }
selectOnMove={ false }
itemRef={ useMergeRefs( [
contentFocusReturnRef,
focusOnMountRef,
listViewRef,
] ) }
tabs={ [
{
name: 'list-view',
Expand All @@ -132,7 +133,10 @@ export default function ListViewSidebar() {
] }
>
{ ( tab ) => (
<div className="edit-post-editor__list-view-container">
<div
className="edit-post-editor__list-view-container"
ref={ listViewContainerRef }
>
{ renderTabContent( tab.name ) }
</div>
) }
Expand Down

0 comments on commit 2386400

Please sign in to comment.