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

[Feat]: Support validation of Picker value without rendered child items #4101

Open
1 task done
spdev3000 opened this issue Feb 29, 2024 · 1 comment
Open
1 task done
Labels
Component: Picker Discovery DSRR Can be visited as part of the research into DOM Scope Request Resolution. enhancement New feature or request

Comments

@spdev3000
Copy link
Collaborator

Code of conduct

  • I agree to follow this project's code of conduct.

Impacted component(s)

Picker

Expected behavior

When user renders a Picker that have already a value set, but the values of the menu-items will be set after initialization - Picker should run some re-comparing and update the current selection state visible in the Picker.

Actual behavior

When user renders a Picker that have already a value set, but the values of the menu-items will be set after initialization (as this happens sometimes in our project) - the value won't be re-compared to selected value and no selection will be shown in Picker.

Screenshots

No response

What browsers are you seeing the problem in?

Chrome

How can we reproduce this issue?

  1. Go to https://studio.webcomponents.dev/edit/fFmXO9B4RPvJVzr9Hbp1/src/index.ts?p=stories
  2. Compare both Pickers and their current selection

Sample code that illustrates the problem

No response

Logs taken while reproducing problem

No response

@spdev3000 spdev3000 added bug Something isn't working Component: Picker triage An issue needing triage labels Feb 29, 2024
@Westbrook Westbrook changed the title [Bug]: Timing issue with current Picker selection and menu-item values [Feat]: Support validation of Picker value without rendered child items Feb 29, 2024
@Westbrook Westbrook added enhancement New feature or request DSRR Can be visited as part of the research into DOM Scope Request Resolution. and removed bug Something isn't working triage An issue needing triage labels Feb 29, 2024
@Westbrook
Copy link
Collaborator

FYI: this is "not a bug" in that those items are required for the Picker to validate itself. I've updated the issue title and labelling to outline this as a feature request for that reason. This does align with some research that we have planned, however I can't speak to any timing around that research having any practical side effects at this time.

If you know the value at initial render, and would like not to append the items/their values, you may look into inserting a dummy Item that possessed that value and removing that when the actual values were later available. Or, if it were acceptable to your interface, you could leave the Picker without a value until you were prepared to populate the Items and then supply a value at that point, when it would actually be possible to validate that value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Picker Discovery DSRR Can be visited as part of the research into DOM Scope Request Resolution. enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants