Skip to content

[1.x & 2.x] common/components/AlertAlertAttrs: ondismiss won't be triggered #4837

Description

@zDaleZ

Current Behavior

Even if an ondismiss function and dismissible: true are specified, closing alert doesn't trigger that function.

It's a long-existed bug, since flarum-pwa uses this to remember user's preference, not to notify user to enable push notification - the result is the extension always show alerts, even if user has closed alerts before.

Steps to Reproduce

Just paste the code below into the console. After closing the alert, you'll easily find the alert() doesn't run.

app.alerts.show({
    dissmissible: true,
    ondismiss: ()=>alert('dismissed')
}, 'test');

Expected Behavior

ondismiss function should be called.

Screenshots

No response

Environment

  • Flarum version: 1.x & 2.x latest version
  • Website URL: N/A
  • Webserver: N/A
  • Hosting environment: N/A
  • PHP version: N/A
  • Browser: Seems happens on all browsers

Output of php flarum info

No response

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions