@ozankurt/context-menu

States

hidden removes a row; disabled keeps it, greys it and still announces it. Both are predicates, both are re-evaluated on every open, and both read the same application state the page below lets you change.

Flip a switch, then right click the same person twice

Your permissions
Members
What to look for
  • Right click Priya Raman, whose invitation is still pending. Send message is there but inert, because she has no inbox yet, while Resend invitation appears for her and for nobody else. Same row, one disabled and one hidden.
  • Clear You are a workspace owner and Remove from workspace is gone from the next menu. So is the separator that would have been left stranded above it.
  • Tick Workspace is read only and the role radios and Reset password stay visible but stop responding, with aria-disabled="true". Arrow keys still land on them, which is the point: a row a screen reader never reaches never explains why the action is unavailable.
  • The role group has no checked field. A radio is checked when meta[group] equals its value, so it reads the row it was opened on.
Separators collapse to a fixed point

Hidden rows are removed first, then any separator that ends up first, last or next to another separator is dropped, repeatedly. Three consecutive separators collapse to none rather than to one, so a menu whose contents are mostly conditional never renders a stack of stray lines.