Excessibility.LiveViewRules.Rules.ClickAwayWithoutEscape (Excessibility v0.14.0)
View SourceFlags elements that use phx-click-away for dismissal but provide no
keyboard equivalent, leaving keyboard and screen-reader users unable
to close the overlay.
What's flagged
An element with phx-click-away that is not:
- carrying a
phx-window-keydownorphx-keydownhandler paired withphx-key="Escape"on the same element - a dialog (
role="dialog"orrole="alertdialog"), which is assumed to manage its own focus and Escape handling
Fix
<!-- Bad -->
<div id="menu" phx-click-away={JS.hide(to: "#menu")}>
...
</div>
<!-- Good -->
<div
id="menu"
phx-click-away={JS.hide(to: "#menu")}
phx-window-keydown={JS.hide(to: "#menu")}
phx-key="Escape"
>
...
</div>