fomantic / Fomantic-UI

Fomantic-UI is the official community fork of Semantic-UI
https://fomantic-ui.com
MIT License
3.58k stars 333 forks source link

[form] `'on': 'blur'` does not clear dropdown field error #2797

Open mvorisek opened 1 year ago

mvorisek commented 1 year ago

Bug Report

Steps to reproduce

  1. open https://jsfiddle.net/4jvtch20/
  2. click "Save" - an error is added to each field (expected/correct)
  3. click "Email" field input, once you focus out of the field, the error for this field is removed
  4. click "Dropdown" field input, no click in/out or value change does remove the field error

Expected result

With 'on': 'blur' I would expect consistent behaviour, ie. error similarly removed for dropdown as for standard input.

Version

2.9.2 / latest

mvorisek commented 1 year ago

@lubber-de shouldn't the dropdown emit blur event as other fields normally does?

lubber-de commented 1 year ago

@lubber-de shouldn't the dropdown emit blur event as other fields normally does?

Given your example, the dropdown does not have a validation rule set. And it also does not have a native (non-hidden, non-search) input field to be validated automatically. Thats, why the validator does completely ignore blurring the dropdown.

I'll try to fetch this situation

mvorisek commented 1 week ago

In https://github.com/atk4/ui/pull/2052 the issue is described a little better.

We set on: 'blur' https://github.com/atk4/ui/blob/4.0.0/src/Form.php#L554 which validates the whole form on blur. For inputs the validation works, but for dropdown it does not.

Currently, custom JS to remove validation errors manually is needed - https://github.com/atk4/ui/pull/2052/files . It works, but I would be happy if this could be addressed in Fomantic UI directly as both components (input, dropdown) are standard Fomantic UI ones.

lubber-de commented 1 week ago

Fixed by #3129 See your adjusted jsfiddle here https://jsfiddle.net/lubber/tmhrgz41/1/