feat(contact-form): enhance validation and accessibility

This commit is contained in:
2025-08-16 08:09:53 -05:00
parent 2f509982f2
commit d742364f46
4 changed files with 117 additions and 51 deletions

View File

@@ -2,6 +2,7 @@ document.addEventListener('DOMContentLoaded', (event) => {
const accordionHeaders = document.querySelectorAll('.accordion-header');
accordionHeaders.forEach(header => {
// Toggle content on click
header.addEventListener('click', () => {
const content = header.nextElementSibling;
if (content.style.display === 'block') {
@@ -10,5 +11,13 @@ document.addEventListener('DOMContentLoaded', (event) => {
content.style.display = 'block';
}
});
// Toggle content on Enter or Space key press
header.addEventListener('keydown', (e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
header.click();
}
});
});
});
});