Angular2-Toaster icon indicating copy to clipboard operation
Angular2-Toaster copied to clipboard

Duplicated Nested Close Buttons after update

Open pantomash opened this issue 3 years ago • 2 comments

I have overrided close button html. In version 8.0.0 generated code was looking fine. After update to newest version 11.0.1 that was needed to update Angular, generated code looks different. Now my custom close button is wrapped by generated button element.

 toasterConfig = new ToasterConfig({
    tapToDismiss: true,
    mouseoverTimerStop: true,
    animation: 'fade',
    timeout: {
      error: NOTIFICATION_TIMEOUT_NONE,
      success: NOTIFICATION_TIMEOUT,
      warning: NOTIFICATION_TIMEOUT,
    },
    showCloseButton: true,
    closeHtml: `<button aria-label="Close" class="toast-close-button">x</button>`,
  })

image

pantomash avatar Jun 23 '21 20:06 pantomash

I think it will be great to set a new optional @Input for the aria-label value as this is a missing part of accessibility in the hardcoded button element.

skrzepij avatar Jun 24 '21 10:06 skrzepij

Correct, in 11.0.0 styles and layout were reworked to create more consistent layout across devices. It also cuts down on the amount of boilerplate magic string content that needs to be provided just to add a button.

It looks like some of the documentation incorrectly still suggests adding explicit <button></button> html for the close button which needs to be updated. In your case @pantomash, your closeHtml simply becomes closeHtml: x.

However, this doesn't solve the issue of binding aria-label and/or classes. I think your idea of an input binding @skrzepij should work and I'll look into getting that change in soon.

Stabzs avatar Jun 29 '21 16:06 Stabzs