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

Hydration issue occurs only IOS by automatically converting numbers to 'a' tag #43914

Open
1 task done
gusrb3164 opened this issue Dec 10, 2022 · 4 comments
Open
1 task done
Labels
bug Issue was opened via the bug report template.

Comments

@gusrb3164
Copy link
Contributor

gusrb3164 commented Dec 10, 2022

Verify canary release

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

Provide environment information

Bug occurs only IOS(mobile safari, Mobile Safari UI/WKWebView, Instagram, ...)

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue

https://github.com/gusrb3164/next-hydration-debug

To Reproduce

  1. npm run dev
  2. enter the localhost:3000 with Iphone safari

Describe the Bug

Error log: Text content did not match. Server: "test : name name test : " Client: "test : name name test : 111-11-11111"

I entered the numbers in p tag.

<p>
    <br />
    test : name name test : 111-11-11111
</p>

The actual variable root.containerInfo.childNodes was converted into a tag as shown in the picture below.

image

Expected Behavior

There is no cause for the hydration issue, but it is occurring.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@gusrb3164 gusrb3164 added the bug Issue was opened via the bug report template. label Dec 10, 2022
@gusrb3164 gusrb3164 changed the title Hydration issue occurs only IOS by automatically converting numbers to a tag Hydration issue occurs only IOS by automatically converting numbers to 'a' tag Dec 11, 2022
@kleintorres
Copy link
Contributor

This is happening because Safari on iOS automatically parse phone numbers as links on the fly, causing a mismatch between what is rendered on server side and on client.

Adding the format-detection meta tag disabling this feature fixes the issue, but I guess is something up to Next developers to do globally or not.

<meta name="format-detection" content="telephone=no"/>

@gusrb3164
Copy link
Contributor Author

Oh, looks like an option that conflicts with hydration. Thank you for your answer.

@ghost
Copy link

ghost commented Feb 14, 2023

For other users who found this article...
I solved it by wrapping it in a span tag

it's sad

@0xliam
Copy link

0xliam commented Jun 15, 2023

This also occurs on Safari for iPadOS. Using the workaround that the ghost user suggested solved this for me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

3 participants