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

Title isn't rendered when a page is opened in a new tab #401

Open
vtenfys opened this issue Sep 26, 2018 · 2 comments
Open

Title isn't rendered when a page is opened in a new tab #401

vtenfys opened this issue Sep 26, 2018 · 2 comments
Labels

Comments

@vtenfys
Copy link

vtenfys commented Sep 26, 2018

Description

When opening a page in a background tab (using control-click or right-click "Open link in new tab"), the title isn't displayed until switching to the tab.

In most cases this isn't an issue since the title is rendered at server-side. However, when using an offline shell with a service worker, or in other cases where the title isn't specified in the HTML source (i.e. without server-side rendering), the issue becomes apparent since the incorrect title can be seen in the tab.

This appears to be due to HelmetUtils.js using requestAnimationFrame which is blocked by Chrome while tabs are in the background - not sure if the problem also occurs on Firefox.

Steps to reproduce

  1. Create a multli-page React project using Helmet, without server-side rendering
  2. Open a link in the background e.g. using "Open link in new tab"

Expected behaviour

The title is immediately visible after opening the tab.

Actual behaviour

The title is not visible in the tab, and instead, the page's path can be seen.

Related: gatsbyjs/gatsby#8089

@AubreyHewes
Copy link
Contributor

@davidbailey00 Yeah nice problem. A workaround I have used to alleviate this problem is to set the document.title on component mount/props-update as the same as the helmet title which would be set in the component render..

@tmbtech tmbtech added the bug label Oct 31, 2018
@beaugunderson
Copy link

beaugunderson commented Jan 26, 2019

answered in #314 / #315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants