Skip to content

fix(menu): sync trigger aria-disabled and tabindex on LiveView patch#67

Open
karim-semmoud wants to merge 2 commits into
mainfrom
fix/menu-disabled-a11y-sync
Open

fix(menu): sync trigger aria-disabled and tabindex on LiveView patch#67
karim-semmoud wants to merge 2 commits into
mainfrom
fix/menu-disabled-a11y-sync

Conversation

@karim-semmoud

@karim-semmoud karim-semmoud commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

Fixes the follow-up to #61 where toggling <.menu disabled={...}> correctly patched native disabled on the trigger, but aria-disabled and tabindex stayed frozen at their initial SSR values. That broke keyboard navigation when enabling a bulk-actions menu after row selection.
Root cause: aria-disabled and tabindex remain in Trigger.ignored_attrs, so LiveView does not patch them. Hook updated() already calls menu.render(), but Zag's getTriggerProps() does not emit those attrs, and spreadProps only toggled native disabled.
This change derives aria-disabled and tabindex from the patched native disabled attribute during client render(), matching Connect.trigger/1.

Will close #59

Changes

  • assets/components/menu.ts: add triggerDisabledAttrs/1 and spread aria-disabled + tabindex on the root trigger in render()
  • assets/test/component/menu.test.ts: cover enable/disable toggle updating a11y attrs
  • e2e/test/components/menu_test.exs: playground disabled switch toggles trigger a11y state
  • e2e/test/support/models/menu_model.ex: helpers for trigger enabled/disabled assertions
  • priv/static/menu.mjs: rebuilt bundle

Test plan

  • pnpm test -- assets/test/component/menu.test.ts
  • mix assets.build
  • cd e2e && mix test test/components/menu_test.exs:82

@karim-semmoud karim-semmoud self-assigned this Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Menu trigger disabled can't be toggled after mount

1 participant