Page MenuHomePhabricator

Safari creates phone links for numbers in format ###-####
Open, Needs TriagePublic

Description

Writing numbers in the format: ###-#### causes Safari on iOS to treat them as a phone link. This format would typically be used for year ranges, e.g. 612-1200.

Apple has an article about this here: https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/PhoneLinks/PhoneLinks.html

Possible solutions might be to hack around it with JS (if possible?), or perhaps disabling default parsing with <meta name = "format-detection" content = "telephone=no">, and require explicitly defining when something should be parsed as a telephone number using <a href="tel:1-408-555-5555">1-408-555-5555</a>.

Reported at: https://en.wikipedia.org/w/index.php?title=Wikipedia:Village_pump_(technical)&oldid=965297714#Phoning_Germany

Event Timeline

Proc created this task.Tue, Jun 30, 1:28 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptTue, Jun 30, 1:28 PM
Proc updated the task description. (Show Details)Tue, Jun 30, 1:31 PM
Xaosflux updated the task description. (Show Details)Tue, Jun 30, 2:35 PM
Xaosflux added a subscriber: Xaosflux.

See also T55315 where this was resolved, but only for editing page on visual editor.

Proc updated the task description. (Show Details)Tue, Jun 30, 2:39 PM

It's not clear to me that the fix in T55315 was deliberate - rather, it seems to have been a case of "something that happened fixed it", as there's no associated patch (although I could very easily be wrong on that, @Jdforrester-WMF will know more!)

If people think it's a good idea so to do, I'm happy to get a patch sorted to give an option on LocalSettings.php, similar to $wgDefaultRobotPolicy, that would allow that meta tag to be added (so enwiki could add it, but we could leave it off on wikivoyage, for instance).

Aklapper added a comment.EditedTue, Jun 30, 5:27 PM

If Safari tries to be smart on random websites out there, e.g. converting years like 2020-2021 into a tel: link though it is no tel: link in the source of the page, then I'd say that a bug report should be filed in Safari's issue tracker instead to allow turn this off in Safari.

Personally I don't think we want to insert <meta name = "format-detection" content = "telephone=no"> into every single page we ship.

Possible solutions might be to hack around it with JS

Date ranges are best written with endash: https://www.thepunctuationguide.com/en-dash.html
Matching dates and replacing - with &ndash; or &#x2013; would be a workaround for that Safari bug and semantically more correct.

This is the way that the web is headed in general from what I can see, whether we like it or not. Edge and IE11+ on Win8+ like to do the same thing, and whilst some are confused by it, it's been there for a while and doesn't seem like there's any much momentum to remove it - especially as the mobile web becomes more dominant.

Possible solutions might be to hack around it with JS

Date ranges are best written with endash: https://www.thepunctuationguide.com/en-dash.html
Matching dates and replacing - with &ndash; or &#x2013; would be a workaround for that Safari bug and semantically more correct.

At the original discussion, an endash is what's being used, and the link is still happening.

Demian added a comment.EditedTue, Jun 30, 6:04 PM

At the original discussion, an endash is what's being used, and the link is still happening.

Bummer. Would have been a neat solution.
As people say there, it's unlikely Safari would fix this in a reasonable timeframe.

It's not clear to me that the fix in T55315 was deliberate - rather, it seems to have been a case of "something that happened fixed it", as there's no associated patch (although I could very easily be wrong on that, @Jdforrester-WMF will know more!)

I vaguely remember that Apple fixed it upstream for us (in the contenteditable context). Note that we found and chose to reject the "fix" of adding a format-detection to every page in MediaWiki precisely because this would disable the functionality on all read pages. If consensus is that this should never be used on any page, we can carry on with that trivial patch, but I'm not sure how we'd determine whether that's the right way to go.

Proc added a comment.Wed, Jul 1, 11:02 AM

@Jdforrester-WMF @Aklapper if the functionality is indeed undesirable I'm not sure if it matters whether Apple fix this on their end (which, ultimately, I'd think any 'fix' would require removal of the feature, since it's hard to determine whether 900-1200 is a phone number or a year) or if MediaWiki does just for its software using the meta tag. (I believe this tag is only recognised by Safari for these purposes, but I could be wrong). Of course, links can still be formatted as tel if they're explicitly formatted as such, and via the use of a template it'd be neater than the a tag everywhere.

I think it's at least worth considering the option for some wikis. enwiki has far more usages of 900-1200 (year) than it does telephone numbers which people might actually want to dial (at a glance, I can only see dummy telephone numbers listed on articles, e.g. 555-5555). Aware some wikis like WikiVoyage may be different, and introducing a default requirement to explicitly state the telephone number may not be an ideal change, but making it opt-out-able doesn't seem to be too harmful?

I vaguely remember that Apple fixed it upstream for us (in the contenteditable context). Note that we found and chose to reject the "fix" of adding a format-detection to every page in MediaWiki precisely because this would disable the functionality on all read pages. If consensus is that this should never be used on any page, we can carry on with that trivial patch, but I'm not sure how we'd determine whether that's the right way to go.

Yeah, it makes sense that contenteditable shouldn't really ever have a clickable telephone number - I can only imagine the pain of trying to move cursors in content, and accidentally calling phones!

As to determining consensus, I've started an RfC on VPT on enwiki to try and gain consensus one way or another on this change. If consensus is determined to be that the change is positive, I'll put together a patch; otherwise, we can close this as WONTFIX.

This fix really should be on the browser side, phone numbers are normally written with a hyphen ("-", 0x2D) while in articles such as the example above with date ranges we normally use the en-dash ("–", 0x2013). Apple probably shouldn't be doing phone number translations on en dashes.

As to determining consensus, I've started an RfC on VPT on enwiki to try and gain consensus one way or another on this change. If consensus is determined to be that the change is positive, I'll put together a patch; otherwise, we can close this as WONTFIX.

To be clear, we're talking about making a change for all thousand Wikimedia-hosted wikis, plus the tens of thousands of public and private MediaWiki sites hosted by everyone from NASA and the CIA to Fandom and the W3C. I'm not sure the views of enwiki alone are the right venue for this kind of decision, sorry.

To be clear, we're talking about making a change for all thousand Wikimedia-hosted wikis, plus the tens of thousands of public and private MediaWiki sites hosted by everyone from NASA and the CIA to Fandom and the W3C. I'm not sure the views of enwiki alone are the right venue for this kind of decision, sorry.

Are we? I wasn't proposing that this be made default behaviour:

If people think it's a good idea so to do, I'm happy to get a patch sorted to give an option on LocalSettings.php, similar to $wgDefaultRobotPolicy, that would allow that meta tag to be added (so enwiki could add it, but we could leave it off on wikivoyage, for instance).

I should have made it clearer that I think the default would be not having the meta tag, sorry. It could be toggled on in LocalSettings as needed.

TheDJ added a subscriber: TheDJ.EditedWed, Jul 1, 12:15 PM

I think this is a good idea, as long as it is configurable via LocalSettings. I'm not entirely sure about what the default value for mediawiki should be however. On the one side, maybe sites currently depend on on this and will be surprised if it suddenly disappears, but also having mw.org defaults out of sync with wmf defaults, tends to be annoying for system adminitrators as well, so.....

Proc added a comment.Wed, Jul 1, 12:49 PM

This fix really should be on the browser side, phone numbers are normally written with a hyphen ("-", 0x2D) while in articles such as the example above with date ranges we normally use the en-dash ("–", 0x2013). Apple probably shouldn't be doing phone number translations on en dashes.

Created a bug on WebKit's Bugzilla for this as well.

Created a bug on WebKit's Bugzilla for this as well.

It would be extremely welcome to share links so other people can also check. :)
https://bugs.webkit.org/show_bug.cgi?id=213836

Proc added a comment.Wed, Jul 1, 5:00 PM

Created a bug on WebKit's Bugzilla for this as well.

I've been informed that this processing is done outside of WebKit, so the issue would need to be reported at https://developer.apple.com/bug-reporting/