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

[Feature] Support for infinite timeout #193

Closed
macias opened this issue Jan 25, 2023 · 2 comments · Fixed by #206
Closed

[Feature] Support for infinite timeout #193

macias opened this issue Jan 25, 2023 · 2 comments · Fixed by #206
Labels
Feature New feature that will be added to the project Needs: Design The issues needs design work before implementing

Comments

@macias
Copy link

macias commented Jan 25, 2023

Many thanks for very useful Blazor library.

Describe the solution you'd like

Support for infinite timeout (preferable value = -1 to be in sync with Timeout.Infinite). This would mean toast would not close itself, but user would have to manually close it.

Describe alternatives you've considered

Using old-fashion JS alert in such cases.

Additional context

Infinite timeout is pretty trivial to add, the question is should progress AND infinite timeout be supported at the same time. If no, this would mean skipping countdown timer entirely (?) but if "yes" it is no longer trivial, because it would mean some animated progress (e.g. like bouncing left and right).

@macias macias added Feature Request Request to add a new feature Triage Issue needs to be triaged labels Jan 25, 2023
@Cvijo
Copy link
Contributor

Cvijo commented Feb 16, 2023

I think this would require some more changes as discussed here

Main question is how to close toast without timeout?

  • ShowCloseButton must be true then even if you send false in settings.
  • What about custom toast components, you don't have close method available and instance of the Toast to close it
  • What about custom CSS on class that can hide close button

I guess simple solution would be if you set unlimited timeout that Toast should have close button always rendered on top even on your custom component over your ChildContent and you can't remove or change it.

Or another maybe dirty solution to override timeout to Int.MaxValue in that case, so it doesn't break other things

@chrissainty
Copy link
Member

Having had some time to noodle on this, I don't think giving Timeout a special value to indicate infinite is the right way to go. If you think about it, It's not an infinite timeout, you're choosing to disable or remove the timeout.

I think the better API is something more obvious, a new option along the lines of NoTimeout. When true, we would omit all of the CountdownTimer code and the toast would display until it was manually closed.

@Cvijo brings up valid questions regarding the presence of a close button. For the default toasts, it should be fine. As suggested, when NoTimeout is true, we can always show the close x on the default toasts. But for custom toasts, we'll have to have faith the developer provides a close button. They do have access to a Close method on the cascaded BlazoredToast instance.

@chrissainty chrissainty added Feature New feature that will be added to the project Needs: Design The issues needs design work before implementing and removed Feature Request Request to add a new feature Triage Issue needs to be triaged labels Feb 16, 2023
@chrissainty chrissainty changed the title [Feature Request] Support for infinite timeout [Feature] Support for infinite timeout Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New feature that will be added to the project Needs: Design The issues needs design work before implementing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants