mirror of
https://github.com/we-promise/sure.git
synced 2026-05-25 05:24:57 +00:00
PR #1840 bumped DS::Button icon-only `:md` size from `w-9 h-9` (36×36) to `w-11 h-11` (44×44) for WCAG 2.5.5 enhanced touch target. DS::Menu's `:icon` variant uses DS::Button at the default `:md` size, so every row-level "..." action-list trigger grew from 36×36 to 44×44. For dense lists where each row has a trigger — most visibly the transaction category dropdown (`category/dropdowns/_row.html.erb`) — the per-row height bump (+8px) compounds: a 5-category panel that used to fit in ~220px now wants ~260px, the badges look smaller relative to the row chrome, and the overall density that made the dropdown scannable regresses visibly. Add an `:icon_sm` variant that renders the trigger as DS::Button at `size: :sm` (32×32). Meets WCAG 2.5.8 AA (24×24) — appropriate for compact in-row triggers where 44×44 isn't required. Standalone toolbar / row-action `...` triggers should keep `:icon` for AAA. Migrate `category/dropdowns/_row.html.erb` to `:icon_sm` to restore the pre-#1840 dropdown density.
37 lines
1.5 KiB
Plaintext
37 lines
1.5 KiB
Plaintext
<%# locals: (category:) %>
|
|
<% is_selected = category.id === @selected_category&.id %>
|
|
|
|
<%= content_tag :div,
|
|
id: dom_id(category, "category_option"),
|
|
role: "option",
|
|
aria_selected: is_selected.to_s,
|
|
class: ["filterable-item flex justify-between items-center border-none rounded-lg px-2 py-1 group w-full hover:bg-container-inset-hover",
|
|
{ "bg-container-inset": is_selected }],
|
|
data: { filter_name: category.name } do %>
|
|
<%= button_to transaction_category_path(
|
|
@transaction.entry,
|
|
grouped: params[:grouped],
|
|
entry: {
|
|
entryable_type: "Transaction",
|
|
entryable_attributes: { id: @transaction.id, category_id: category.id }
|
|
}
|
|
),
|
|
method: :patch,
|
|
data: { turbo_frame: "category_dropdown" },
|
|
class: "flex w-full items-center gap-1.5 cursor-pointer focus:outline-none" do %>
|
|
|
|
<%= icon("check") if is_selected %>
|
|
|
|
<% if category.subcategory? %>
|
|
<%= icon("corner-down-right", size: "sm") %>
|
|
<% end %>
|
|
|
|
<%= render partial: "categories/badge", locals: { category: category } %>
|
|
<% end %>
|
|
|
|
<%= render DS::Menu.new(variant: :icon_sm) do |menu| %>
|
|
<% menu.with_item(variant: "link", text: t(".edit"), icon: "pencil-line", href: edit_category_path(category), data: { turbo_frame: :modal }) %>
|
|
<% menu.with_item(variant: "link", text: t(".delete"), icon: "trash-2", href: new_category_deletion_path(category), data: { turbo_frame: :modal }, destructive: true) %>
|
|
<% end %>
|
|
<% end %>
|