Dynamic window title #5893
Copy link
Copy link
Closed
Description
Currently all our admin app browser tabs are named in the same way; and the names in the browser history aren't really helpful neither:
Maybe we could add some useEffect code to https://github.com/marmelab/react-admin/blob/master/packages/ra-ui-materialui/src/layout/Title.tsx that updates the document.title whenever new title is set? WDYT?
Reacted by Adrien Amoros, Gildas Garcia, Francois Zaninotto, Andrii Oriekhov, Dirk Klimpel, Gavin Elster, Mathias Malmqvist, Le_Futuriste, strarsis and Bastien Dumont
Reacted by Gildas Garcia and strarsis
Metadata
Metadata
Assignees
Labels
No labels

Activity
MicroJackson commentedon Feb 11, 2021
How I do it with my React Admin:
And it shows that in the history and as the title.
But maybe a MaterialUI update version is better.
djhi commentedon Feb 11, 2021
@jtomaszewski Thanks for the suggestion! Would you mind creating a PR for it?
andrico1234 commentedon Apr 2, 2021
Is someone currently working on this? If not, I'd be happy to give it a shot
andrico1234 commentedon Apr 2, 2021
@djhi I got carried away 😅
#6118
fzaninotto commentedon May 31, 2021
Fixed by #6119
andrico1234 commentedon Jul 5, 2021
@fzaninotto can we re-open this issue as the change was reverted. I'm going to give @wmwart's suggestion,
fzaninotto commentedon Jul 6, 2021
Yep, the fix was reverted in #6357, so I'm reopening it.
panfiva commentedon Feb 1, 2022
FYI, users can customize browser page title using react-helmet. See example code that can be placed in Show, Edit, List or Create components.
btoro commentedon Sep 14, 2022
Ideally, the <Title/> component would automatically sent the title over to Helmet, rather than having users add the title to each page / view.
You can use react portals to inject the title into the <title> component of react-helmet, but unfortunately, RA adds an additional around the text, which messes up the header title.
It would be great if we can override the Title component as part of the customization / layout
lefuturiste commentedon May 1, 2024
@fzaninotto I'm interested to work on this issue. Before opening a new PR, I will discuss the details here.
For a start, I propose to make this feature an opt-in change. So by default it keep the same behavior as before.
So probably we should add a new boolean prop, eg.
mirrorTitleToDocumentTitle={true}fzaninotto commentedon May 14, 2024
React 19 introduces the
<title>tag that does exactly that. If we can use if in a backward-compatible way (i.e. without breaking apps using React 18), it's the best solution. We could simply updatePageTitleto set<title>in addition to theTitlePortal.feat: Sync the browser tab title with the page title
ThieryMichel commentedon Oct 26, 2026
Fixed #11412
will be available in v5.16.0 release