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

input phone / react: country code not recognized #2275

Open
MarekLacoAXA opened this issue Apr 26, 2022 · 7 comments
Open

input phone / react: country code not recognized #2275

MarekLacoAXA opened this issue Apr 26, 2022 · 7 comments
Labels
Accepted A feature request or issue is accepted and will be implemented Bug

Comments

@MarekLacoAXA
Copy link
Contributor

MarekLacoAXA commented Apr 26, 2022

EXPECTED: country code prefix (+41 Deutschland) of value (maybe defaultValue too?) gets recognized and displayed in dropdown.

ACTUAL: dropdown stays Schweiz in all cases; Textfied contains +49 prefix on most cases, see screenshot.

Code: (spaces / no spaces):

           <AXAInputPhoneReact value="+49 123"/>
           <AXAInputPhoneReact defaultValue="+49 123"/>
           <AXAInputPhoneReact value="+49 123" defaultValue="+49 123"/>

          <AXAInputPhoneReact value="+49123"/>
          <AXAInputPhoneReact defaultValue="+49123"/>
          <AXAInputPhoneReact value="+49123" defaultValue="+49123"/>

Screen:

image

@markus-walther
Copy link
Contributor

This is a consequence of violating https://github.com/axa-ch-webhub-cloud/pattern-library/tree/develop/src/components/20-molecules/input-phone#value requirements, i.e. no space between country code and local phone number. As such this is not a bug, since the behaviour is deliberate and documented.

Also see #2277 (comment) for deeper explanation.

@MarekLacoAXA
Copy link
Contributor Author

SORRY, there is is typo in my OP!
Is: "country code prefix (+41 Deutschland)"
Should be: "country code prefix (+49 Deutschland)"

Question remains: why does the dropdown show "Schweiz (+41)" when "+49 " prefix is supplied in value? Screnshot

image

@markus-walther
Copy link
Contributor

OK, I could reproduce it. Likely fix will be for the defaultValue case.

@markus-walther markus-walther added the Accepted A feature request or issue is accepted and will be implemented label May 30, 2022
@markus-walther
Copy link
Contributor

Screen Shot 2022-05-30 at 19 33 15

@markus-walther
Copy link
Contributor

@MarekLacoAXA I intend to fix this bug by processing defaultValue once after the initial render, handling composite numbers there as well.

Note that the UI encourages a separate selection of country-code and phone number, that's almost the whole point of why we have that component in the first place. Composite numbers were added for user-pasting of existing numbers, e.g. from other web documents, they are not the main focus of this component, merely a convenience feature.

So, initializing it from a composite number is an oddity, but I am willing to make an exception here.

@MarekLacoAXA
Copy link
Contributor Author

Hi @markus-walther !
I think this issue might be related to the Datepicker, same as in the other issue here: #2274

When datepicker is in place, then the dropdown shows "S..." (see my screenshots).
Without datepicker included, the dropdown shows "+49" (see your screenshots).

@MarekLacoAXA
Copy link
Contributor Author

@MarekLacoAXA I intend to fix this bug by processing defaultValue once after the initial render, handling composite numbers there as well.

I think that processing "each time" when "defaultValue" changes, would be better (more natural) then processing only "once".
While processing "once" is probably mostly sufficient, still it could lead to surprises when a consumer decides to change defaultValue over time and would wonder why there is no reaction from the component.

Note that the UI encourages a separate selection of country-code and phone number, that's almost the whole point of why we have that component in the first place.

I would like to let users edit existing numbers using this component. Existing numbers means: numbers were entered PRIOR using this component: so there is no assurance that a space separator is in place between country prefix and national number.

Composite numbers were added for user-pasting of existing numbers, e.g. from other web documents, they are not the main focus of this component, merely a convenience feature.
So, initializing it from a composite number is an oddity, but I am willing to make an exception here.

Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted A feature request or issue is accepted and will be implemented Bug
Projects
None yet
Development

No branches or pull requests

2 participants