-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Blazor with maui can not use <InputSelect> or <select> #4325
Comments
This may be caused by the fact that there is no a wrapping Form element and that may be causing a hidden exception. |
Thanks,I will try it. |
It is also bad,but,I have an inconvenient way to fix it
when it run,do this: It is very very inconvenient |
I'm seeing a similar problem in the latest preview, running VS Enterprise 2022 17.1.0 Preview 4.0, debugging for a Windows machine targeting net6.0-windows10.0.19041: @page "/newsurvey"
@using MauiBlazorAppTest.Data
<EditForm Model="@survey" OnInvalidSubmit="@StartSurvey">
<DataAnnotationsValidator />
<ValidationSummary />
<p>
<label class="form-label">Derivative
<InputSelect @bind-Value="survey.Derivative" class="form-select">
<option selected>Select the derivative...</option>
<option value="Derivative1">First Derivative</option>
<option value="Derivative2">Second Derivative</option>
<option value="Derivative3">Third Dervative</option>
</InputSelect>
</label>
</p>
<button type="submit" class="btn btn-primary">Start Survey</button>
</EditForm>
@code {
private SurveyModel survey = new() { };
private void StartSurvey()
{
//start the survey
}
} This page itself renders correctly, but the dropdown doesn't respond when I click on it: As hy999 mentioned, it does respond to other events, such as selecting the element and pressing [Enter] to make the dropdown render, as well as the up and down arrow keys to go through the options. It seems to be isolated to the onClick event. |
<select>
<option value="0">test</option>
<option value="1">test2</option>
<option value="2">test3</option>
</select>
<EditForm Model="model">
<InputSelect @bind-Value="model.Vehicle">
@foreach (var value in Enum.GetValues(typeof(Vehicle)))
{
<option>@value</option>
}
</InputSelect>
</EditForm>
@code {
Model model = new Model();
class Model
{
public Vehicle Vehicle { get; set; }
}
enum Vehicle
{
Car,
Truck,
Van,
Bike
}
} @davidalucas I tried repro'ing your issue, but it's working fine for me (at least on iOS). Are you experiencing the issue specifically on Windows or other platforms as well? Are you able to provide a minimal, public, github repository app that reproduces this issue. Simulator.Screen.Recording.-.iPad.mini.6th.generation.-.2022-01-28.at.12.23.43.mp4 |
Hello, I'm having the same issue. This issue only happens in 'Windows Machine'. It works fine in Android / iOS. A code as simple as below renders, but when I click in the select element, the select list doesn't expand. Truth to be told, the list just blinks (opens and then close immediately, I can't even see if the items were rendered in the list).
|
Hello, I have same issue as the Felipe on the "Windows Machine". When i click on the element, list just flashes and closes.
|
That sounds like this WebView2 bug, which repros in MAUI on Windows: MicrosoftEdge/WebView2Feedback#1693 Try clicking the dropdown and then pressing Alt+Down on the keyboard and that will open it. (That's just a workaround - the actual bug is being fixed by the WebView2/WinUI team. |
Thanks for the workaround and I'm glad it is being fixed. |
What about MacOS and Android? Does anybody know if its working there? Thanks. |
@Laftek MAUI only uses WebView2 on Windows, so a WebView2 bug wouldn't affect macOS/iOS/Android. |
@SteveSandersonMS Thanks Steve! I wasnt sure if this is bug only in WebView2. |
Only a bug with WebView2 specifically on WinUI, which is what .NET MAUI uses. It doesn't affect WebView2 for WinForms and WPF apps. |
Thanks all! It looks like that WebView2 bug is probably what I'm running into as well. There are some other UI behaviors I've noticed which are having similar problems on Windows machines, but I'll wait for that WebView2 bug patch before submitting any new issues. |
I've confirmed this isn't an issue on Android/iOS earlier. Thanks @Eilon for pointing out the WebView2 bug. Should we keep this issue open tracking the external MicrosoftEdge/WebView2Feedback#1693 or would it be safe to close this out as a 'duplicate'? |
@TanayParikh if the only "active" issue in this thread is the dropdown that disappears on WinUI, then I recommend closing this issue because there's no action to take. We have email threads with the WebView2 folks on the dropdown issue so it's not getting forgotten. |
Not reproducible with 17.2.0 Preview 2.0 [32209.335.main] using Windows. |
Description
1,when I write this code:
the application print "An unhandled error has occurred."
2,When I try to use
<select>
label in the page, It is dosen't work.Steps to Reproduce
1,Open a page
2,Add the Select like:
or
They are dosen't work
Version with bug
Preview 12 (current)
Last version that worked well
Unknown/Other
Affected platforms
I was not able test on other platforms
Affected platform versions
10.0.19041.0
Did you find any workaround?
none
Relevant log output
No response
The text was updated successfully, but these errors were encountered: