Your disclosure on the Balai’s board used three ways: Wulan clicks, Bayu presses Enter and Space, Mr. Sugeng hears expanded or collapsed, and what does he…
Accordions, dropdowns, hamburger menus, "read more": disclosures are everywhere. Without the right state a screen reader user cannot tell their click worked, and a <div onClick> cannot even be reached by keyboard. It is one of the most often missed accessibility fixes, and one of the cheapest.
aria-expanded announces the state, button brings the keyboard
aria-expanded not updated when the button toggles Set "false" once and never changed = the screen reader always says closed. Change aria-expanded in the same function that changes the panel (and style the icon from [aria-expanded="true"] so it stays right too).<div> cannot be Tabbed to or pressed A div takes no focus, has no role and ignores Enter/Space. Use <button>. If a div you must: role="button", tabindex="0" and a keydown handler for Enter + Space.aria-controls pointing at an id that does not exist Its value must equal the id of a panel in the DOM exactly. One wrong letter and the link breaks without an error.aria-expanded and the panel change together; what Mr. Sugeng hears switches between "expanded" and "collapsed" too.setAttribute off in the script, then open it The panel opens, Mr. Sugeng still hears "collapsed".<button> to <div>, then try Tab focus() does not land: Tab skips it, and its role becomes plain text.div + role="button" situation, Tab to it, press Enter It takes focus and is announced as a button, yet Enter does nothing: the keyboard is yours to handle.