Accessibility / Analysis / Role Constraint Solver

The Role Constraint Solver bookmarklet checks ARIA widget roles for proper required child ownership relationships. Validates listbox/option, tablist/tab, and menu/menuitem relationships, identifies parent elements missing required child roles, and proposes fixes (e.g., "Add role='option' to first child"). Displays an alert listing all ownership gaps found with suggested remedies. Useful for verifying ARIA widget patterns are correctly implemented. Role, Value.

WCAG SC 1.3.1: Info and RelationshipsWCAG SC 4.1.2: Name
Run Role Constraint Solver

Test run or drag to
bookmarklets bar to install

javascript:%21function()%7B%22use%20strict%22%3Btry%7Bconst%20o%3D%7Blistbox%3A%7Bowns%3A%5B%22option%22%5D%7D%2Ctablist%3A%7Bowns%3A%5B%22tab%22%5D%7D%2Cmenu%3A%7Bowns%3A%5B%22menuitem%22%2C%22menuitemcheckbox%22%2C%22menuitemradio%22%5D%7D%7D%2Ce%3D%5B%5D%3Bfor(const%20t%20of%20Object.keys(o))%7Bconst%20n%3D%5B...document.querySelectorAll(%60%5Brole%3D%22%24%7Bt%7D%22%5D%60)%5D%3Bfor(const%20r%20of%20n)%7Bconst%20n%3Do%5Bt%5D.owns%3Bif(%21n.some(o%3D%3Er.querySelector(%27%5Brole%3D%22%27%2Bo%2B%27%22%5D%27)))%7Bconst%20o%3Dr.firstElementChild%3Be.push(%7Bel%3Ar%2Crole%3At%2Cfix%3Ao%3F%60Add%20role%3D%22%24%7Bn%5B0%5D%7D%22%20to%20first%20child%60%3A%22Add%20a%20child%20with%20the%20required%20role%22%7D)%7D%7D%7Dlet%20t%3De.length%3Fe.map(o%3D%3E%60%5B%24%7Bo.role%7D%5D%20%24%7Bo.fix%7D%60).join(%22%5Cn%22)%3A%22No%20ownership%20gaps%20found%22%3Balert(t)%2Cconsole.log(%22%5CnSource%3A%20https%3A%2F%2Fgithub.com%2Falejandrogiga98%2FA11y-Bookmarklets%5CnBookmarklet%20name%3A%20Role%20constraint%20solver%5CnAuthor%3A%20alejandrogiga98%5CnLicense%3A%20MIT%20License%5Cn%22)%7Dcatch(o)%7Balert(%22Bookmarklet%20Error%3A%20%22%2Bo.message)%7D%7D()%3B
← Back to all bookmarklets