Accessibility / Forms / Form Error Exerciser

The Form Error Exerciser bookmarklet tests form validation behavior by clearing required fields and triggering validation. Finds the first form element, clears all required fields, calls reportValidity() or checkValidity() to trigger browser validation, checks whether focus moved to the first invalid field, and verifies that aria-describedby references point to valid elements. Displays an alert with validation result, count of invalid fields, first error focus status, and bad aria-describedby references.

WCAG SC 3.3.1: Error IdentificationWCAG SC 3.3.3: Error Suggestion
Run Form Error Exerciser

Test run or drag to
bookmarklets bar to install

javascript:%21function()%7B%22use%20strict%22%3Btry%7Bconst%20e%3Ddocument.querySelector(%22form%22)%7C%7Cdocument.querySelector(%27%5Brole%3D%22form%22%5D%27)%3Bif(%21e)return%20void%20alert(%22No%20form%20found%22)%3Bconst%20t%3D%5B...e.querySelectorAll(%22input%2Cselect%2Ctextarea%22)%5D.filter(e%3D%3E%21e.disabled)%3Bfor(const%20e%20of%20t)if(e.required%7C%7C%22true%22%3D%3D%3De.getAttribute(%22aria-required%22))try%7Be.value%3D%22%22%7Dcatch%7B%7Dconst%20r%3Ddocument.activeElement%2Co%3De.reportValidity%3Fe.reportValidity()%3Ae.checkValidity()%2Cn%3D%5B...e.querySelectorAll(%22%3Ainvalid%22)%5D%3Blet%20l%3Ddocument.activeElement%26%26document.activeElement%21%3D%3Dr%3Fdocument.activeElement%3Anull%3Bconst%20i%3Dn.filter(e%3D%3E%7Bconst%20t%3D(e.getAttribute(%22aria-describedby%22)%7C%7C%22%22).trim().split(%2F%5Cs%2B%2F).filter(Boolean)%3Breturn%20t.length%26%26%21t.every(e%3D%3Edocument.getElementById(e))%7D).length%3Balert(%60Valid%3A%20%24%7Bo%7D%20%20Invalid%20fields%3A%20%24%7Bn.length%7D%5CnFirst%20error%20focus%3A%20%24%7Bl%3Fl.name%7C%7Cl.id%7C%7Cl.tagName%3A%22(none)%22%7D%5CnBad%20aria-describedby%20refs%3A%20%24%7Bi%7D%60)%2Cconsole.log(%22%5CnSource%3A%20https%3A%2F%2Fgithub.com%2Falejandrogiga98%2FA11y-Bookmarklets%5CnBookmarklet%20name%3A%20Form%20error%20exerciser%5CnAuthor%3A%20alejandrogiga98%5CnLicense%3A%20MIT%20License%5Cn%22)%7Dcatch(e)%7Balert(%22Bookmarklet%20Error%3A%20%22%2Be.message)%7D%7D()%3B
← Back to all bookmarklets