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

Bug: cannot remove/clear document title #710

Open
JakeSidSmith opened this issue Sep 18, 2023 · 2 comments
Open

Bug: cannot remove/clear document title #710

JakeSidSmith opened this issue Sep 18, 2023 · 2 comments

Comments

@JakeSidSmith
Copy link

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

Attempting to remove a title with any of the following does not remove the title: <title>{''}</title>, <title>{undefined}</title>, <title />

Minimal reproduction: https://codepen.io/jakesidsmith/pen/abPLPxm

What is the expected behavior?

The document title should be removed (set to empty string).

Which versions of React and react-helmet, and which browser / OS are affected by this issue?
Did this work in previous versions of React and/or react-helmet?

react@18.2.0
react-helmet@6.1.0

I have not tested any other versions.

Additional notes:

This is a particularly frustrating limitation as I intend to use react-helmet within one of my libraries, so I won't have control over users' code, but I want users of my library to be able to see where they have forgotten to add a title and currently (because react-helmet maintains the previous title) it is hard to know where titles have been missed. To make things worse, only after reloading the page, or a user navigating to a page for the first time will the missing title be highlighted.

@JakeSidSmith
Copy link
Author

I opened an issue rather than a pull request, as I'm not sure if this is intended behavior.

If this is intended, then it would be nice to have an option to disable it. I'd be happy to add this feature myself.

@moon-xt
Copy link

moon-xt commented Mar 4, 2024

same issue

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

No branches or pull requests

2 participants