Skip to content

Commit

Permalink
Fix editor header hidden in Firefox (woocommerce#38247)
Browse files Browse the repository at this point in the history
* Update page config to add support for layout header/footer

* Fix lint error
  • Loading branch information
louwie17 authored May 18, 2023
1 parent 5d6b3d5 commit 2843fbb
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: update

Remove css unrelated to the product block editor.
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,3 @@
display: none; // use important or increase specificity.
}
}

.woocommerce-layout:has( .woocommerce-product-block-editor ) {
.woocommerce-layout__header {
display: none;
}
}
6 changes: 6 additions & 0 deletions plugins/woocommerce-admin/client/layout/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ export const getPages = () => {
navArgs: {
id: 'woocommerce-add-product',
},
layout: {
header: false,
},
wpOpenMenu: 'menu-posts-product',
capability: 'manage_woocommerce',
} );
Expand All @@ -196,6 +199,9 @@ export const getPages = () => {
navArgs: {
id: 'woocommerce-edit-product',
},
layout: {
header: false,
},
wpOpenMenu: 'menu-posts-product',
capability: 'manage_woocommerce',
} );
Expand Down
25 changes: 14 additions & 11 deletions plugins/woocommerce-admin/client/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ function _Layout( {
);
}

const { breadcrumbs } = page;
const { breadcrumbs, layout = { header: true, footer: true } } = page;
const { header: showHeader = true, footer: showFooter = true } = layout;

const query = Object.fromEntries(
new URLSearchParams( location && location.search )
Expand All @@ -199,15 +200,17 @@ function _Layout( {
>
<SlotFillProvider>
<div className="woocommerce-layout">
<Header
sections={
isFunction( breadcrumbs )
? breadcrumbs( { match } )
: breadcrumbs
}
isEmbedded={ isEmbedded }
query={ query }
/>
{ showHeader && (
<Header
sections={
isFunction( breadcrumbs )
? breadcrumbs( { match } )
: breadcrumbs
}
isEmbedded={ isEmbedded }
query={ query }
/>
) }
<TransientNotices />
{ ! isEmbedded && (
<PrimaryLayout>
Expand All @@ -226,7 +229,7 @@ function _Layout( {
<WCPayUsageModal />
</Suspense>
) }
<Footer />
{ showFooter && <Footer /> }
<CustomerEffortScoreModalContainer />
</div>
<PluginArea scope="woocommerce-admin" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: update

Add support for `showHeader` config in router config to hide header if needed.

0 comments on commit 2843fbb

Please sign in to comment.