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

SVG <title> tag is either removed, or used as page title #42226

Closed
1 task done
alexbassy opened this issue Oct 31, 2022 · 5 comments
Closed
1 task done

SVG <title> tag is either removed, or used as page title #42226

alexbassy opened this issue Oct 31, 2022 · 5 comments
Assignees
Labels
area: app App directory (appDir: true) locked

Comments

@alexbassy
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: Ubuntu 20.04.0 LTS Mon Oct 31 2022 11:57:49 GMT+0100 (Central European Standard Time)
Binaries:
  Node: 16.14.2
  npm: 7.17.0
  Yarn: 1.22.19
  pnpm: 7.13.6
Relevant packages:
  next: 13.0.1-canary.2
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

Version 106.0.5249.119

How are you deploying your application? (if relevant)

No response

Describe the Bug

The <title> tag inside an inlined SVG is either removed from the markup (hindering accessibility) OR* it is actually become the meta page title of the document (the title you see in your browser tab that is defined in app/head.tsx).

I noticed this behaviour on my own site. I have an inline SVG in the footer of the root layout. When I run the dev server or build the site, the <title> of the page was the <title> of this SVG file. Only when I removed the title was it replaced with the title defined in app/head.tsx.

I tried to make a minimal reproduction of this issue in StackBlitz. While I couldn’t get 100% there (the built page shows the correct title), you can still observe the behaviour if you change the <title> of the SVG and save the file. Furthermore, when the SVG is inspected in dev tools, the <title> attribute is not there.

Here is a video reproduction using Safari, but I was otherwise using Chrome for everything else

Kapture.2022-10-31.at.12.07.00.mp4

Expected Behavior

  • The <title> attribute of the SVG is not removed
  • The <title> of the document is only taken from head.tsx

Link to reproduction

https://stackblitz.com/edit/vercel-next-js-cugnsk?file=components%2FInlineSVG.tsx

To Reproduce

  1. Open reproduction link
  2. Click “open in new tab” at the top right, so you can see the page title
  3. Back in StackBlitz, modify the title of the SVG
  4. Observe the page tab title of the page. It will now be what you put into the SVG
  5. Inspect the SVG and observe lack of <title> element
@alexbassy alexbassy added the bug Issue was opened via the bug report template. label Oct 31, 2022
@timneutkens timneutkens added area: app App directory (appDir: true) kind: bug and removed bug Issue was opened via the bug report template. labels Nov 1, 2022
@timneutkens
Copy link
Member

Thanks! This is related to the way React finds title and injects it into the head. @gnoff will have a look.

@ariesclark
Copy link

This is a blocking issue for a project migration, is there any estimate on when this will be resolved? Thanks very much.

@gnoff
Copy link
Contributor

gnoff commented Nov 8, 2022

@ariesclark this should be fixed in the latest release. Are you still seeing the issue?

will be fixed after: #42639

@ariesclark
Copy link

This issue is now resolved.

@shuding shuding closed this as completed Aug 18, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 2, 2023

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Sep 2, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: app App directory (appDir: true) locked
Projects
None yet
Development

No branches or pull requests

5 participants