<% if as == :button %> <%# Wrap the trigger icon in a focusable ` <% else %> <%# `as: :span` — used when the tooltip is rendered inside an already-focusable interactive ancestor (e.g. ``), where the HTML spec forbids nested interactive content. Keyboard reveal is wired in the controller, which (in addition to listening on the outer span for the standalone case) also binds `focusin/focusout/keydown` on the closest `` ancestor — because `focusin` only bubbles UP, a listener on this descendant span would never fire when the ancestor disclosure receives focus. %> <%= helpers.icon icon_name, size: size, color: color %> <% end %>