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

Blazor: add support for beforetoggle event #53336

Closed
1 task done
chucker opened this issue Jan 12, 2024 · 3 comments
Closed
1 task done

Blazor: add support for beforetoggle event #53336

chucker opened this issue Jan 12, 2024 · 3 comments
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved

Comments

@chucker
Copy link

chucker commented Jan 12, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I am trying to use onbeforetoggle to manipulate an element before it appears.

Describe the solution you'd like

Support onbeforetoggle. The event type is ToggleEvent, which we already have.

Additional context

The larger goal here was to use https://developer.mozilla.org/en-US/docs/Web/API/Popover_API.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Jan 12, 2024
@javiercn
Copy link
Member

@chucker thanks for contacting us.

You can already do this yourself by using a custom event handler as described https://learn.microsoft.com/en-us/aspnet/core/blazor/components/event-handling?view=aspnetcore-8.0#general-configuration

Note that there are things that due to Blazor's nature will not be possible to do (like modifying the HTML element using C# before the event applies, as that would require everything to run synchronously, which is not guaranteed and not something we are willing to depend on).

@javiercn javiercn added question ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. labels Jan 15, 2024
@ghost ghost added the Status: Resolved label Jan 15, 2024
@ghost
Copy link

ghost commented Jan 16, 2024

This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.

See our Issue Management Policies for more information.

@ghost ghost closed this as completed Jan 16, 2024
@xcaptain
Copy link

@javiercn Hello, I'm also trying the new popover api on blazor wasm, I have a similar problem, I don't need to listen to the beforetoggle event, I want to know how to call the hidePopover method of the popover dom element. For example, I want to hide the popover after I clicked the dropdown items.

image

Mozilla doc: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/hidePopover

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved
Projects
None yet
Development

No branches or pull requests

3 participants