From 062bf5be99a18f15bbfbf21d0ec87d2cde0557b7 Mon Sep 17 00:00:00 2001 From: Sarah Fossheim Date: Thu, 16 Jan 2025 01:44:02 +0100 Subject: [PATCH] give remove button icon alt that matches the label --- src/js/components/filters.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/js/components/filters.js b/src/js/components/filters.js index e39dde73..7ad9f4e9 100644 --- a/src/js/components/filters.js +++ b/src/js/components/filters.js @@ -218,14 +218,19 @@ class Filters { const techCount = document.querySelectorAll('select.tech[name="tech"]').length; const techNr = techCount + 1; const techId = `tech-${techNr}`; + const techLabel = `Technology ${techNr}`; selectElement.setAttribute('id', techId); labelElement.setAttribute('for', techId); - labelElement.textContent = `Technology ${techNr}`; + labelElement.textContent = techLabel; if(removeButton) { removeButton.dataset.tech = techId; removeButton.classList.remove('hidden'); + const removeIcon = removeButton.querySelector('img'); + const removeIconAlt = removeIcon.getAttribute('alt'); + removeIcon.setAttribute('alt', `${removeIconAlt} ${techLabel}`); + /* Bind functionality to the button */ removeButton.addEventListener('click', this.removeTechnology); }