Skip to content

Alert dismiss button broken: alertCallback calls hide() instead of close() #1562

@eXistenZNL

Description

@eXistenZNL

Bug report

Description

In v9, dismissible alerts no longer work. Clicking a [data-mdb-dismiss="alert"] button does nothing.

Root cause

In src/js/autoinit/callbacks/free.js, alertCallback calls:

enableDismissTrigger(Alert);

This defaults method to 'hide', but Alert only implements close(), not hide(). The correct call already exists in src/js/bootstrap/mdb-prefix/alert.js:79 but is commented out:

// enableDismissTrigger(Alert, 'close')

Expected fix

Change the call in alertCallback to:

enableDismissTrigger(Alert, 'close');

Steps to reproduce

  1. Use mdb-ui-kit v9
  2. Add a dismissible alert with data-mdb-alert-init and a close button using data-mdb-dismiss="alert"
  3. Click the close button
  4. Nothing happens

Environment

  • mdb-ui-kit: v9.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions