diff --git a/src/toastify-es.js b/src/toastify-es.js index e036994..6d2767e 100644 --- a/src/toastify-es.js +++ b/src/toastify-es.js @@ -238,10 +238,11 @@ class Toastify { // Adding a close icon to the toast if (this.options.close === true) { // Create a span for close element - let closeElement = document.createElement("span"); - closeElement.innerHTML = "✖"; - + let closeElement = document.createElement("button"); + closeElement.type = "button"; + closeElement.setAttribute("aria-label", "Close"); closeElement.className = "toast-close"; + closeElement.innerHTML = "✖"; // Triggering the removal of toast from DOM on close click closeElement.addEventListener( diff --git a/src/toastify.css b/src/toastify.css index 5fe826a..15f9537 100644 --- a/src/toastify.css +++ b/src/toastify.css @@ -28,6 +28,12 @@ } .toast-close { + background: transparent; + border: 0; + color: white; + cursor: pointer; + font-family: inherit; + font-size: 1em; opacity: 0.4; padding: 0 5px; } diff --git a/src/toastify.js b/src/toastify.js index a2c02b8..9f334b9 100644 --- a/src/toastify.js +++ b/src/toastify.js @@ -160,10 +160,11 @@ // Adding a close icon to the toast if (this.options.close === true) { // Create a span for close element - var closeElement = document.createElement("span"); - closeElement.innerHTML = "✖"; - + var closeElement = document.createElement("button"); + closeElement.type = "button"; + closeElement.setAttribute("aria-label", "Close"); closeElement.className = "toast-close"; + closeElement.innerHTML = "✖"; // Triggering the removal of toast from DOM on close click closeElement.addEventListener(