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(forms): Handle error display when no focus and blur events is called #2737

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

henit
Copy link
Contributor

@henit henit commented Oct 9, 2023

When a custom component was build using useDataValue without calling focus and blur callbacks, like if forgotten during development, or for interfaces where it is not possible (like based on one time clicks), validation was performed, but the error was never displayed because the hook was waiting for a blur event to actually return the error. Fix: If focus has not been called before a change callback, assume the events are not being used so show the error message as long as the value is invalid (unless continuousValidation is false). I added tests for this in a separate test file for the useDataValue hook since the existing field compoinents like `Field.String actually call focus/blur.

@vercel
Copy link

vercel bot commented Oct 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 Oct 9, 2023 11:37am

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 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 f950fae:

Sandbox Source
eufemia-starter Configuration

Copy link
Member

@tujoworker tujoworker left a comment

Choose a reason for hiding this comment

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

Looks good! Great work and good tests 👌

@henit henit merged commit 63f6e87 into main Oct 10, 2023
@henit henit deleted the fix/forms-handle-missing-focus-blur branch October 10, 2023 07:18
tujoworker pushed a commit that referenced this pull request Oct 19, 2023
## [10.10.0](v10.9.0...v10.10.0) (2023-10-19)

### 📝 Documentation

* add info about how to find out what Eufemia version is used ([#2722](#2722)) ([0740b4c](0740b4c))
* **ArraySelection:** removes redundant/circular link ([94ca03a](94ca03a))
* **ArraySelection:** removes redundant/circular link ([#2735](#2735)) ([800589f](800589f))
* formats value prop as code ([#2692](#2692)) ([7c3b81e](7c3b81e))
* **Intro:** add breadcrumb for mitigate lack of orientation ([#2709](#2709)) ([69c3f16](69c3f16))
* **Layout:** fix import of ux-layout-spacing.png ([53db314](53db314))
* **Layout:** fix import of ux-layout-spacing.png ([#2733](#2733)) ([60067b7](60067b7))
* **Layout:** move layout (spacing and media query) docs to layout component docs ([#2724](#2724)) ([3f1f809](3f1f809))
* **Pagination:** Updated links to GitHub examples ([#2732](#2732)) ([3ced434](3ced434))
* **PaymentCard:** adds docs for formatCardNumber function ([c271cb6](c271cb6))
* **PaymentCard:** adds docs for formatCardNumber function ([#2702](#2702)) ([976c19f](976c19f))
* **PhoneNumber:** updates Component-specific props docs ([0265689](0265689))
* **PhoneNumber:** updates Component-specific props docs ([#2688](#2688)) ([751c5b2](751c5b2))
* **Portal:** add View Transition ([#2675](#2675)) ([4636276](4636276))
* **Portal:** fix anchor hash highlighting ([#2705](#2705)) ([9c6299e](9c6299e))
* update docs about `gatsby-plugin-eufemia-theme-handler` ([#2740](#2740)) ([61074a7](61074a7))

### ✨ Features

* **Anchor:** add correct icon padding + embed target blank icon for Sbanken compatibility ([#2770](#2770)) ([24cb49d](24cb49d))
* **Anchor:** fix no-style and no-hover ([#2739](#2739)) ([3965e3c](3965e3c))
* **Anchor:** hide anchor protocol icon ([#2749](#2749)) ([7472265](7472265))
* **Card:** add new Card component (beta) ([#2744](#2744)) ([cf0d5b6](cf0d5b6))
* deprecate FormRow and FormSet in favor of Flex layout and Forms Extension ([#2753](#2753)) ([6e392f9](6e392f9))
* **Dialog:** sbanken theme ([#2626](#2626)) ([f1781c1](f1781c1))
* **Dropdown:** add support for numeric values by using selectedKey or object based data entries ([#2666](#2666)) ([06281e4](06281e4))
* **Dropdown:** provide React refs support with the innerRef and buttonRef props ([#2665](#2665)) ([1d8d206](1d8d206))
* **fieldset:** add SASS mix-in `fieldsetReset` ([#2759](#2759)) ([c16be9b](c16be9b))
* **Flex:** add new Flex layout component ([#2748](#2748)) ([def1ad1](def1ad1))
* **Form.Handler:** call reset on form submit ([#2765](#2765)) ([4356b0f](4356b0f))
* **FormLabel and FieldBlock:** add heading typography size prop ([#2758](#2758)) ([3916fc2](3916fc2))
* **Forms:** add innerRef to Field.String for React.ref support ([#2679](#2679)) ([930b89d](930b89d))
* **Forms:** alignSelf on Flex components ([#2662](#2662)) ([0c46e36](0c46e36))
* **Forms:** enable tree-shaking compatibility ([#2713](#2713)) ([711bde7](711bde7))
* **forms:** Session storage on Provider and add defaultData prop ([62413f0](62413f0))
* **Layout:** add css Grid component ([#2731](#2731)) ([25ffbf8](25ffbf8))
* **Layout:** release Layout component ([#2628](#2628)) ([47f0018](47f0018))
* **Slider:** Sbanken styling ([#2716](#2716)) ([b8751bd](b8751bd))
* **Tabs:** Sbanken styling ([#2682](#2682)) ([68da886](68da886)), closes [#2640](#2640) [#2631](#2631) [#2622](#2622)
* **Theme:** generate all properties in javascript file ([#2658](#2658)) ([6c70c63](6c70c63))
* **Theming:** refactor the internal structure + align DNB Eiendom theme and Anchor styles ([#2653](#2653)) ([c46caed](c46caed))
* **Upload:** Sbanken styling ([#2693](#2693)) ([992e10c](992e10c))
* **useMedia:** add new props: queries and breakpoints ([#2661](#2661)) ([a59633f](a59633f))

### 🐛 Bug Fixes

* **Anchor:** add --anchor-background-gutter ([#2721](#2721)) ([48a6084](48a6084))
* **Autocomplete:** fix rehydration disturbance ([#2761](#2761)) ([9ac6a4d](9ac6a4d))
* **Breadcrumb:** allow Button props on Breadcrumb.Item ([#2676](#2676)) ([ed95f6b](ed95f6b))
* **Breadcrumb:** avoid React warning about duplication of key ([#2687](#2687)) ([1e7d100](1e7d100))
* **DrawerList:** ensure links do wrap to new line ([#2700](#2700)) ([c994df4](c994df4)), closes [#2698](#2698)
* **FieldBlock:** automate label in label detection ([#2668](#2668)) ([5902824](5902824))
* **Forms:** ensure error shows correct border and text colors ([#2717](#2717)) ([f1bc34d](f1bc34d))
* **forms:** Handle error display when no focus and blur events is called ([#2737](#2737)) ([63f6e87](63f6e87))
* **forms:** Phone number merged with country code, bugfixes ([#2755](#2755)) ([5e13b6c](5e13b6c))
* **Forms:** precede children over title in Selection ([#2664](#2664)) ([52e8d49](52e8d49))
* **GlobalStatus:** error state not applied on prop change ([#2768](#2768)) ([8864c4c](8864c4c))
* **Lead:** can now accept className prop without losing styling ([#2741](#2741)) ([3d68caa](3d68caa))
* **PaymentCard:** correctly export type for getCardData function ([cfaacdb](cfaacdb))
* **PaymentCard:** correctly export type for getCardData function ([#2704](#2704)) ([288de11](288de11))
* **PaymentCard:** removes excess space when formatting card number ([f079fa6](f079fa6))
* **PaymentCard:** removes excess space when formatting card number ([#2703](#2703)) ([4e35d27](4e35d27))
* **Slider:** allow negative values ([#2697](#2697)) ([380bb51](380bb51))
* **Slider:** make key navigation work when swapping position ([#2729](#2729)) ([b19a41e](b19a41e))
* **StepIndicator:** react on changes to `is_current` data property ([#2757](#2757)) ([b3a1a0f](b3a1a0f))
@tujoworker
Copy link
Member

🎉 This PR is included in version 10.10.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