Skip to content

Commit

Permalink
give remove button icon alt that matches the label
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahfossheim committed Jan 16, 2025
1 parent 3a125ad commit 062bf5b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/js/components/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 062bf5b

Please sign in to comment.