<%= wrapper_element do %> <%# `role="dialog"` + `aria-modal="true"` is redundant with `` in modern browsers, but Safari and screen readers older than the 2024 WAI-ARIA Mapping still benefit from the explicit role. `aria-labelledby` is always emitted with the stable `title_id`. When the header slot rendered an auto-title (the common case), AT resolves the reference and announces the title. When no title is rendered (`custom_header: true`, body-only dialogs), the dangling reference is silently ignored per the WAI-ARIA spec, and callers can supply `aria-label` / `aria-labelledby` via `**opts` (last-wins) for an explicit accessible name. The conditional `if has_auto_title?` gate was a no-op here: the `renders_one :header` slot lambda is evaluated lazily at slot-render time (after the `` opening tag attributes are computed), so the flag was never `true` when this attribute was read. %> <%= tag.dialog class: "w-full h-full bg-transparent text-primary theme-dark:backdrop:bg-alpha-black-900 backdrop:bg-overlay pt-[env(safe-area-inset-top)] pb-[env(safe-area-inset-bottom)] #{(drawer? || responsive?) ? "lg:p-3" : "lg:p-1"}", role: "dialog", "aria-modal": "true", "aria-labelledby": title_id, **merged_opts do %> <%= tag.div class: dialog_outer_classes do %> <%= tag.div class: dialog_inner_classes, data: { DS__dialog_target: "content" } do %>
"> <% if header? %> <%= header %> <% end %> <% if body? %>
<%= body %> <% if sections.any? %>
<% sections.each do |section| %> <%= section %> <% end %>
<% end %>
<% end %> <%# Optional, for customizing dialogs %> <%= content %>
<% if actions? %>
<% actions.each do |action| %> <%= action %> <% end %>
<% end %> <% end %> <% end %> <% end %> <% end %>