W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2010

[whatwg] Changing punctuation value of input element in telephone state

From: Kit Grose <kit@iqmultimedia.com.au>
Date: Wed, 7 Apr 2010 11:45:05 +1000
Message-ID: <AB099012-6831-4029-9A1B-756CA80D80A0@iqmultimedia.com.au>
On 07/04/2010, at 9:21 AM, Mounir Lamouri wrote:
> When I was using MacOS X, I hated how the contact application was
> restyling my phone numbers.

I'm surprised this was an issue; the Mac OS X Address Book contains a dedicated preferences screen to allow you to define custom formatting rules if they don't automatically behave as you'd like.

In fact, my suggestion to the entire list was to fall back on the OS-native Address Book's settings for formatting phone numbers, since that is a setting that is certainly going to be the same for a given user between his or her address book and web browser.

When it comes to applying formatting, the OS X Address Book (apparently) does it as follows:
1. Don't apply any format while the field has keyboard focus (least surprise)
2. When the field loses focus, the OS checks the number of digits in the input and compares that to the formats defined in the preferences. If no format is defined for that number of digits, don't change the input at all.
3. If (at least one) format exists for the number of digits entered, apply the format to the input

In practice there are two things I feel the OS X Address Book does unexpectedly:
1. I would suggest that if the user enters his or her input including spaces and/or parentheses, those should be maintained (perhaps this is deliberate to allow the pasting/data detection of arbitrary formatted content into the field, but in practice it means I can't override a format for a single number)
2. If two formats are defined for the same number of digits, only the first is applied (in eastern Australia, there are two conventions for 10-digit phone numbers; landlines are defined as, for example, ## #### #### whereas mobiles are in the format #### ### ###). If I define each of those formats as custom formats, only the first in the list is applied for 10-digit numbers (even if I enter the number precisely following the other format). To work around that issue, I have to define the format as "04## ### ###", which works in Australia but might be too restrictive for some other cultures.

Cheers,


Kit Grose
User Experience + Tech Director,
iQmultimedia

(02) 4260 7946
kit at iqmultimedia.com.au
iqmultimedia.com.au
Received on Tuesday, 6 April 2010 18:45:05 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:22 UTC