Skip to content

Commit

Permalink
Add aria-describedby attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
alberto-rj authored Jun 9, 2024
1 parent 3389bb5 commit f2a442d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ const emailOutput = document.getElementById('emailOutput');
const showError = () => {
emailParent.classList.add('invalid');
emailField.setAttribute('aria-invalid', 'true');
emailField.setAttribute('aria-describedby', 'emailError');
};

const hideError = () => {
emailParent.classList.remove('invalid');
emailField.removeAttribute('aria-invalid');
emailField.removeAttribute('aria-describedby');
};

const showComponent = component => {
Expand Down Expand Up @@ -75,4 +77,4 @@ const addMoveAnimation = () => {
emailField.addEventListener('input', handleInput);
form.addEventListener('submit', handleSubmit);
dismissBtn.addEventListener('click', handleDismiss);
window.addEventListener('DOMContentLoaded', addMoveAnimation);
window.addEventListener('DOMContentLoaded', addMoveAnimation);

0 comments on commit f2a442d

Please sign in to comment.