w3c / contact-picker

Contact Picker API
https://www.w3.org/TR/contact-picker/
Other
74 stars 8 forks source link

maybe split up name to to components? #29

Open jimmywarting opened 4 years ago

jimmywarting commented 4 years ago

I gave this some thoughts about how i was going to map the contact's name into my two input fields (namely "firstname" and "lastname") cuz what i got back was the full name, so i needed a way to split it.

My first thought where: "did i save this contacts name into just one field?" but when i edited the contact, then it was already split up into components.

I read some documentation about autocompletion at mdn and it says this:

"name"
The field expects the value to be a person's full name. Using "name" rather than breaking the name down into its components is generally preferred because it avoids dealing with the wide diversity of human names and how they are structured; however, you can use the following autocomplete values if you do need to break the name down into its components:
"honorific-prefix"
The prefix or title, such as "Mrs.", "Mr.", "Miss", "Ms.", "Dr.", or "Mlle.".
"given-name"
The given (or "first") name.
"additional-name"
The middle name.
"family-name"
The family (or "last") name.
"honorific-suffix"
The suffix, such as "Jr.", "B.Sc.", "PhD.", "MBASW", or "IV".
"nickname"
A nickname or handle.

i think this maybe could be useful to have that option as well.

navigator.contacts.select(["name"]) // full name (given name + family name)
navigator.contacts.select(["given-name"]) // firstname
navigator.contacts.select(["family-name"]) // lastname
navigator.contacts.select(["given-name", "family-name"]) // first & last name separated
finnur-thorarinsson commented 3 weeks ago

While it is common for last names to be family names, such as in the US (example: "The Johnsons"), I think we should pick some other label than "family-name". Because some cultures use patronymic or matronymic naming system, where there is no single family name that is either adopted (by the spouse) or inherited (by the children).

In a patronymic family, the mother, father, son and daughter each have different last names. The only sharing of last names is when the family includes two or more children of the same sex -- and in no case is it a family name that inherits.