Don't modify the document title on existing WooCommerce pages. (https://github.com/woocommerce/woocommerce-admin/pull/3585)

This commit is contained in:
Jeff Stieler 2020-01-20 10:34:24 -07:00 committed by GitHub
parent 0169dd26bb
commit 25c09563a1
2 changed files with 17 additions and 6 deletions

View File

@ -32,6 +32,7 @@ class Header extends Component {
this.onWindowScroll = this.onWindowScroll.bind( this );
this.updateIsScrolled = this.updateIsScrolled.bind( this );
this.trackLinkClick = this.trackLinkClick.bind( this );
this.updateDocumentTitle = this.updateDocumentTitle.bind( this );
}
componentDidMount() {
@ -64,9 +65,14 @@ class Header extends Component {
recordEvent( 'navbar_breadcrumb_click', { href, text: event.target.innerText } );
}
render() {
updateDocumentTitle() {
const { sections, isEmbedded } = this.props;
const { isScrolled } = this.state;
// Don't modify the document title on existing WooCommerce pages.
if ( isEmbedded ) {
return;
}
const _sections = Array.isArray( sections ) ? sections : [ sections ];
const documentTitle = _sections
@ -83,6 +89,14 @@ class Header extends Component {
getSetting( 'siteTitle', '' )
)
);
}
render() {
const { sections, isEmbedded } = this.props;
const { isScrolled } = this.state;
const _sections = Array.isArray( sections ) ? sections : [ sections ];
this.updateDocumentTitle();
const className = classnames( 'woocommerce-layout__header', {
'is-scrolled': isScrolled,

View File

@ -585,10 +585,7 @@ class Loader {
public static function update_admin_title( $admin_title ) {
if (
! did_action( 'current_screen' ) ||
(
! self::is_admin_page() &&
! self::is_embed_page()
)
! self::is_admin_page()
) {
return $admin_title;
}