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

<SelectField> does not trigger onChange for default value #570

Closed
sfeidersullivan opened this issue Aug 6, 2019 · 2 comments
Closed

<SelectField> does not trigger onChange for default value #570

sfeidersullivan opened this issue Aug 6, 2019 · 2 comments
Assignees
Labels
Type: Bug Bug reports and their fixes

Comments

@sfeidersullivan
Copy link

Description

When <SelectField> defaults to the first allowedValue, that value can no longer be selected without changing to another value then changing back.

This is intended behavior for a <select> tag where state is handled by the DOM, but seems like unintended behavior for uniforms where components are controlled by outside state.

Aug-05-2019 17-52-06

Steps to reproduce

  1. https://uniforms.tools/playground#?N4IgDgTgpgzlAuIBcIDqUA2BjA9gWygEIQAacCHMGZUAQwFd4cZaA3KZAM1ozjIaYt2AEUy0AnsgCMABhlkAJgEsWAIwxQFXHnxAZaqzMngR6UMmH1YoACxwYFUCNt7mQMLDah5ayEADsoAHcAAgBlJTxLKDDPb1oACmAAHX8Q9JCYJQAvKCQQlLSM4vhxMDzwkyV_AHMSVOLingwcIM0ANR4zGHyAbQByAA8YfpIQ_pGx_rxR8YxZofmAXQaMgF96_zWASlJ3OyCASX8MaqgAUQgKZyRuV34YcX8sAHl_MPpVPCVEW503WiPZ5vTqnBS0eAcP6uDYgeBeAh-OA-fzwJRYEBrIA
  2. Select 'xs' from dropdown
  3. Click Submit

Affects uniforms-semantic, uniforms-bootstrap, and uniforms-unstyled (any that use <select> tags)

Expected Behavior

If user selects 'xs', the state should be updated

Works fine for uniforms-material since a placeholder is always added as the first item.

Would also be fine if a null or "please select" option was added by default, or if it was clear that the user must pass one in.

@radekmie radekmie self-assigned this Aug 7, 2019
@radekmie radekmie added the Type: Bug Bug reports and their fixes label Aug 7, 2019
@radekmie
Copy link
Contributor

radekmie commented Aug 7, 2019

Hi @sfeidersullivan. It works correctly if you enable the placeholder for this field. I have to think about how to make it consistent between themes.

@radekmie
Copy link
Contributor

Now it seems to be consistent and fully usable. All fields without value start with placeholders, and only optional ones are allowed to set it back (which clears the value).

@Monteth Monteth added this to Closed in Open Source (migrated) Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug reports and their fixes
Projects
Archived in project
Development

No branches or pull requests

2 participants