Nuxt.js: render issue on mobile safari

Created on 14 Jan 2017  路  8Comments  路  Source: nuxt/nuxt.js

Hi,
Thanks for the awesome work, I was playing around nuxt.js, although its still lack of documents, its still works nice.

I ran into this problem on iOS safari, not sure if it is a bug.

this is my layout default.vue

<template lang="pug">
#wrapper
  transition(name="fade", mode="out-in")
    #notify(v-if="notifyMessage")
      .restrict.notify-box {{notifyMessage}}
  my-header
  main#main
    nuxt
  my-footer
</template>

I tried on my OSX Sierra with chrome, firefox and safari, iphone 6 10.2 with Chrome, page renderer in the tag 'nuxt' without any problem. but when using the default safari on iOS, the header and footer still rendered, the 'nuxt' section will disapear.

Try here: https://notable.wushan.io/
Source: https://github.com/wushan/notable-frontend

Thank you.

This question is available on Nuxt.js community (#c107)

Most helpful comment

Hi guys, just wanted to shed some light on this since I think I ran into the same problem.

iOS Safari autorenders an anchor tag with href to phone number if it detects a phone number on the page. This cases a mismatch in the html between server rendered and Vue instance.

<span>074-444 44 44</span> automagically becomes <span><a href="tel:074-444 44 44">074-444 44 44</a></span> in iOS Safari in iOS 10.

This unfortunately wipes the element in your HTML. With the html mismatch message.

Workaround is to render the anchor tag with the tel:number href in your html so you don't have a mismatch.

All 8 comments

finally figure out the problem but really wired.

form.controls(@submit.stop.prevent="startSearch", v-bind:class="{error: $v.number.$error}")
            input.phone-type(type="search", v-model.trim="number", v-bind:class="{active:number}", @input="$v.number.$touch()" @keyup="clearError")
            button(type="submit", @click="$v.$touch") 鎼滃皨
            span ex:0978978078锛涘競瑭憋細0228785487 - 涓嶇敤鑷繁杓稿叆绌烘牸
            span.valid-notifier(v-if="!$v.number.required") (蹇呭~娆勪綅)
            span.valid-notifier(v-if="!$v.number.minLength") (闆昏┍鏍煎紡涓嶆纰猴紒)
            span.valid-notifier(v-if="!$v.number.maxLength") (铏熺⒓鏈夐粸澶氾紒)

after delete the line beside 'button', the 'span' tag which doesn't have an v-if condition, it prevents the bug.

Hi @wushan

It's good that you find a way to fix it 馃憤

Hi guys, just wanted to shed some light on this since I think I ran into the same problem.

iOS Safari autorenders an anchor tag with href to phone number if it detects a phone number on the page. This cases a mismatch in the html between server rendered and Vue instance.

<span>074-444 44 44</span> automagically becomes <span><a href="tel:074-444 44 44">074-444 44 44</a></span> in iOS Safari in iOS 10.

This unfortunately wipes the element in your HTML. With the html mismatch message.

Workaround is to render the anchor tag with the tel:number href in your html so you don't have a mismatch.

I think this needs to be opened as a bug. If you have a phone number in a layout template, components will not render. Patrik's workaround is great for now, (thanks Patrik). It poses bigger issue for long term support, what if they want to manipulate the dom for addresses next?

I stumbled upon this issue and maybe it can be documented in a common (or browser specific) problems section.

I stumbled into this problem and just wanted to add a short term solution.
Add this meta into the nuxt.config.js file

head: { 
  meta: [
    { 'name': 'format-detection', 'content': 'telephone=no' }
  ] 
}

and if you really need telephone number links, create them explicitly.

Not sure if I should open a new issue for this or not, but should the meta tag linked above be the default for a Nuxt app? It seems that excluding it will break any site with a phone number not wrapped in an anchor tag on iOS. Including it will just mean that users can't tap the phone number like they might expect. It seems that missing functionality is a better default than a broken site, especially when a developer can add in the anchor tag themselves.

(I'm happy to open another issue to propose this if that is better. Thanks.)

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VincentLoy picture VincentLoy  路  3Comments

danieloprado picture danieloprado  路  3Comments

mikekidder picture mikekidder  路  3Comments

bimohxh picture bimohxh  路  3Comments

pehbehbeh picture pehbehbeh  路  3Comments