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

Can't set initial value on a <select> #16465

Closed
SteveSandersonMS opened this issue Feb 23, 2018 · 0 comments
Closed

Can't set initial value on a <select> #16465

SteveSandersonMS opened this issue Feb 23, 2018 · 0 comments
Assignees
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@SteveSandersonMS
Copy link
Member

Currently, the logic in BrowserRenderer.ts performs the DOM updates in such an order that it can't set the .value on a <select> (unless it was already populated earlier).

It's because it tries to apply attributes to elements first before then populating their descendants. That's no good for a <select>, because you can't set the .value to anything that doesn't already match one of the <option> descendants.

To fix this:

  • Change the logic in insertElement to populate descendants before applying attributes
  • Change the logic in the EditType.setAttribute case in applyEdits to apply edits to descendants before applying edits to attributes
  • Add tests for all these scenarios

If it turns out this is insufficient (e.g., there are also cases where you need to set the attributes before updating descendants) we'll need more HTML-specific logic that uses different update orders depending on the element types.

SteveSandersonMS referenced this issue in SteveSandersonMS/BlazorMigration Nov 27, 2018
@mkArtakMSFT mkArtakMSFT transferred this issue from dotnet/blazor Oct 27, 2019
@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label Oct 27, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

2 participants