The personal finance app for everyone (by everyone)
Ruby
fix(reports): stop Safari swallowing every click on the reports page (#3365)
AlexNovRS7adf44ddf0d9a
diff --git a/app/views/reports/_category_row.html.erb b/app/views/reports/_category_row.html.erbindex b1a7661c47..fcb04e1994 100644--- a/app/views/reports/_category_row.html.erb+++ b/app/views/reports/_category_row.html.erb@@ -11,9 +11,9 @@%><tr data-category="category-<%= item[:category_id] %>"- class="text-secondary text-sm <%= show_border ? "table-divider" : "" %> <%= clickable ? "relative group/category-row" : "" %>">+ class="text-secondary text-sm <%= show_border ? "table-divider" : "" %> <%= clickable ? "group/category-row" : "" %>"><td colspan="2" class="py-3 px-4 lg:px-6 <%= is_sub ? "pl-7 lg:pl-9" : "" %>">- <div class="flex items-center gap-2">+ <div class="flex items-center gap-2 <%= clickable ? "relative" : "" %>"><% if is_sub %><div class="text-subdued"><%= icon "corner-down-right" %>@@ -38,8 +38,12 @@) %><% end %><% if clickable %>- <%# Stretched link covers the full row (mirrors dashboard outflows).- `before:absolute before:inset-0` is positioned against the relative <tr>. %>+ <%# Stretched link covers the category cell. The overlay is anchored to the+ flex wrapper above, NOT to the <tr>: `position: relative` on a table row+ does not establish a containing block in WebKit (it is left undefined by+ CSS 2.1 9.3.1, and Safari does not implement it). Anchoring to the row+ therefore let the overlay escape and blanket the whole page in Safari,+ swallowing every click on /reports into this drill-down. %><%= link_to item[:category_name],transactions_href,class: "font-medium text-primary hover:underline before:absolute before:inset-0 before:content-['']",diff --git a/test/controllers/reports_controller_test.rb b/test/controllers/reports_controller_test.rbindex 62e1031ee7..d2729540b4 100644--- a/test/controllers/reports_controller_test.rb+++ b/test/controllers/reports_controller_test.rb@@ -442,8 +442,11 @@ class ReportsControllerTest < ActionDispatch::IntegrationTestassert_select "tr[data-category='category-#{income_category.id}'] a[href=?]", income_href, text: income_category.nameassert_select "tr[data-category='category-uncategorized'] a[href=?]", uncategorized_href, text: Category.uncategorized.name- # Full-row hit target via stretched ::before (mirrors dashboard outflows)- assert_select "tr.relative.group\\/category-row[data-category='category-#{expense_category.id}'] a[class*='before:absolute'][class*='before:inset-0']"+ # Hit target via stretched ::before, anchored to the category cell's flex+ # wrapper. Deliberately NOT the <tr>: CSS 2.1 9.3.1 leaves position:relative+ # undefined on table rows and WebKit does not implement it, so anchoring+ # there let the overlay escape and swallow every click on the page in Safari.+ assert_select "tr.group\\/category-row[data-category='category-#{expense_category.id}'] td div.relative a[class*='before:absolute'][class*='before:inset-0']"endtest "index uncategorized category link uses localized name that Search accepts" do