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

fix(PhoneNumber): keep selected countryCode value on blur #2869

Merged
merged 2 commits into from
Nov 13, 2023

Conversation

tujoworker
Copy link
Member

@tujoworker tujoworker commented Nov 9, 2023

The change: When the user changes the countryCode value – without making a "selection" – and then the input blurs, it will show the current selected value. This way, it will not be possible to "clear" a country code or add a custom.

But that also requires us to deliver all possible available codes. The error rate will be way lower for sure. Now, its more like a Dropdown, but with fee text search ability.

Here's a demo.

Copy link

vercel bot commented Nov 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
eufemia ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2023 0:03am

@tujoworker tujoworker changed the title fix(PhoneNumber): keep selected value on on blur fix(PhoneNumber): keep selected countryCode value on on blur Nov 9, 2023
@tujoworker tujoworker requested review from langz and henit November 9, 2023 15:50
Copy link

codesandbox-ci bot commented Nov 9, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit cc1c0f3:

Sandbox Source
eufemia-starter Configuration

@tujoworker tujoworker changed the title fix(PhoneNumber): keep selected countryCode value on on blur fix(PhoneNumber): keep selected countryCode value on blur Nov 9, 2023
Copy link
Contributor

@langz langz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some testing, and it works as expected 💯

An additional thought, not 100% related to this fix/PR, is if this feature(that the user can't unselect the country code) will "limit" the usage of the component? As if this component would be included in a form with a lot of optional fields(non-required) then this field would always have a value 🤔

@tujoworker
Copy link
Member Author

Good point! That's actually anyway an issue. So I suggest we should only show an error when required, if the second field is empty. And maybe only return the code value if a phone number value exists?

@langz
Copy link
Contributor

langz commented Nov 10, 2023

Good point! That's actually anyway an issue. So I suggest we should only show an error when required, if the second field is empty. And maybe only return the code value if a phone number value exists?

Agree agree 👍
Wouldn't that be a "breaking change"? Maybe we wouldn't have to treat it as a breaking change in terms of semver, since these features are under the "beta"-flag 😎

@tujoworker tujoworker force-pushed the feat/phone-number-keep-value branch 2 times, most recently from 09e15b2 to 44b2e92 Compare November 13, 2023 11:37
@tujoworker tujoworker force-pushed the feat/phone-number-keep-value branch 2 times, most recently from 4943073 to cc1c0f3 Compare November 13, 2023 11:46
@tujoworker tujoworker merged commit 7e0f9c5 into main Nov 13, 2023
7 checks passed
@tujoworker tujoworker deleted the feat/phone-number-keep-value branch November 13, 2023 12:29
tujoworker pushed a commit that referenced this pull request Nov 16, 2023
## [10.14.0](v10.13.0...v10.14.0) (2023-11-16)

### 📝 Documentation

* **Forms:** lists component specific props 1st ([#2892](#2892)) ([c05740c](c05740c))
* **PhoneNumber:** remove unsupported props ([#2894](#2894)) ([4800a8e](4800a8e))
* **PostalCodeAndCity:** remove unsupported props ([#2890](#2890)) ([fe1ee9e](fe1ee9e))

### ✨ Features

* **Forms:** expiry field ([#2660](#2660)) ([af5aa61](af5aa61))
* **forms:** improved state management and reacting to more changed props ([#2882](#2882)) ([0ca9533](0ca9533))
* **Input:** add clear button event "on_clear" ([#2898](#2898)) ([eb6b722](eb6b722))
* **Radio:** Sbanken styling ([#2888](#2888)) ([d7ffcf8](d7ffcf8))

### 🐛 Bug Fixes

* add "use client" to non hook components like the Button ([#2895](#2895)) ([2d54a13](2d54a13))
* **Autocomplete:** enhance logic for when to blur ([#2886](#2886)) ([ce5c3fa](ce5c3fa))
* **Autocomplete:** make clear button work with enter key ([#2901](#2901)) ([30007c4](30007c4)), closes [#2185](#2185)
* **FieldBlock:** enhance fieldset/legend detection ([#2902](#2902)) ([4c62052](4c62052)), closes [#2893](#2893)
* fix Flex and Grid export to work with Vite.js ([#2905](#2905)) ([ef83713](ef83713))
* fix vertical label_direction support for Radio group and ToggleButton group ([#2899](#2899)) ([d650c66](d650c66))
* **forms:** Field block error handling ([#2900](#2900)) ([9582c64](9582c64))
* **forms:** Improved message value replacements ([#2903](#2903)) ([a61140b](a61140b))
* **PhoneNumber:** keep selected countryCode value on blur ([#2869](#2869)) ([7e0f9c5](7e0f9c5))
@tujoworker
Copy link
Member Author

🎉 This PR is included in version 10.14.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants