mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 23:12:04 +00:00
fix(admin): keep a sideways-scrolling table from widening the page on a phone
The login overview's IP button gained screen-reader text, which is absolutely positioned. Inside a scroll container that is not positioned, its containing block lies outside the container, so the span escaped the container's clipping and every row panned past the edge widened the page: the admin page scrolled sideways at 390 px. Every overflow-x-auto wrapper around a table is now relative (the admin sections, the settings token tables and the Coach result table), and a guard holds that.
This commit is contained in:
1 parent
dda4c57f5a
commit
294be53883
13 files changed
+86
-16
No files matched your search
@@ -83,7 +83,9 @@ describe("AppLogPreviewSection — summary lives outside the scroll wrapper", ()
|
||||
const summaryIdx = html.indexOf('data-testid="app-log-preview-summary"');
|
||||
expect(summaryIdx).toBeGreaterThan(-1);
|
||||
const before = html.slice(0, summaryIdx);
|
||||
const lastScrollOpen = before.lastIndexOf('class="overflow-x-auto"');
|
||||
const lastScrollOpen = before.lastIndexOf(
|
||||
'class="relative overflow-x-auto"',
|
||||
);
|
||||
expect(lastScrollOpen).toBeGreaterThan(-1);
|
||||
const tail = before.slice(lastScrollOpen);
|
||||
expect(tail).toContain("</div>");
|
||||
@@ -92,7 +94,7 @@ describe("AppLogPreviewSection — summary lives outside the scroll wrapper", ()
|
||||
it("does not nest the summary copy inside the scroll wrapper", () => {
|
||||
const html = render();
|
||||
const wrapper = html.match(
|
||||
/<div class="overflow-x-auto"[^>]*>[\s\S]*?<\/table><\/div>/,
|
||||
/<div class="relative overflow-x-auto"[^>]*>[\s\S]*?<\/table><\/div>/,
|
||||
);
|
||||
expect(wrapper).not.toBeNull();
|
||||
expect(wrapper![0]).not.toContain("app-log-preview-summary");
|
||||
|
||||
@@ -98,7 +98,9 @@ describe("LoginOverviewSection — pagination lives outside the scroll wrapper",
|
||||
);
|
||||
expect(paginationIdx).toBeGreaterThan(-1);
|
||||
const before = html.slice(0, paginationIdx);
|
||||
const lastScrollOpen = before.lastIndexOf('class="overflow-x-auto"');
|
||||
const lastScrollOpen = before.lastIndexOf(
|
||||
'class="relative overflow-x-auto"',
|
||||
);
|
||||
expect(lastScrollOpen).toBeGreaterThan(-1);
|
||||
// Between the scroll-wrapper opening and the pagination opening
|
||||
// there must be at least one `</div>` closing the wrapper.
|
||||
@@ -114,7 +116,7 @@ describe("LoginOverviewSection — pagination lives outside the scroll wrapper",
|
||||
// same depth — naively by grabbing up to `</table></div>`, which
|
||||
// matches the structure produced by the current implementation.
|
||||
const wrapper = html.match(
|
||||
/<div class="overflow-x-auto"[^>]*>[\s\S]*?<\/table><\/div>/,
|
||||
/<div class="relative overflow-x-auto"[^>]*>[\s\S]*?<\/table><\/div>/,
|
||||
);
|
||||
expect(wrapper).not.toBeNull();
|
||||
expect(wrapper![0]).not.toContain("admin.section.auditLog.next");
|
||||
|
||||
@@ -117,7 +117,7 @@ export function AiQualitySection() {
|
||||
title={t("admin.aiQuality.empty")}
|
||||
/>
|
||||
) : (
|
||||
<div className="overflow-x-auto">
|
||||
<div className="relative overflow-x-auto">
|
||||
<table className="w-full text-sm" data-slot="ai-quality-table">
|
||||
<thead>
|
||||
<tr className="text-muted-foreground border-border border-b text-left text-xs tracking-wider uppercase">
|
||||
|
||||
@@ -185,7 +185,7 @@ export function ApiTokenOverviewSection() {
|
||||
inner `overflow-x-auto` is a belt-and-suspenders guard
|
||||
for medium viewports with extra-long permission
|
||||
lists. */}
|
||||
<div className="hidden overflow-x-auto md:block">
|
||||
<div className="relative hidden overflow-x-auto md:block">
|
||||
<table className="w-full table-fixed text-sm">
|
||||
<colgroup>
|
||||
<col className="w-[18%]" />
|
||||
|
||||
@@ -279,7 +279,7 @@ export function AppLogPreviewSection() {
|
||||
// the table is scrolled horizontally. The refresh control was
|
||||
// already in the header above the table wrapper.
|
||||
<>
|
||||
<div className="overflow-x-auto">
|
||||
<div className="relative overflow-x-auto">
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="text-muted-foreground border-b text-xs">
|
||||
|
||||
@@ -1286,7 +1286,7 @@ export function BackupsSection() {
|
||||
{/* Wide layout: the canonical table. Hidden below `md`, where the
|
||||
five columns push Download / Restore off-screen behind a
|
||||
horizontal scroll; the card list below takes over there. */}
|
||||
<div className="hidden overflow-x-auto md:block">
|
||||
<div className="relative hidden overflow-x-auto md:block">
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="text-muted-foreground border-b text-xs">
|
||||
|
||||
@@ -112,7 +112,7 @@ export function CoachFeedbackSection() {
|
||||
title={t("admin.coachFeedback.empty")}
|
||||
/>
|
||||
) : (
|
||||
<div className="overflow-x-auto">
|
||||
<div className="relative overflow-x-auto">
|
||||
<table className="w-full text-sm" data-slot="coach-feedback-table">
|
||||
<thead>
|
||||
<tr className="text-muted-foreground border-border border-b text-left text-xs tracking-wider uppercase">
|
||||
|
||||
@@ -457,7 +457,7 @@ export function ColumnCoverage({
|
||||
sideways, and a keyboard user has to be able to reach it
|
||||
(axe scrollable-region-focusable). */
|
||||
<div
|
||||
className="overflow-x-auto"
|
||||
className="relative overflow-x-auto"
|
||||
tabIndex={0}
|
||||
role="region"
|
||||
aria-label={t("admin.section.encryption.columnsTitle")}
|
||||
|
||||
@@ -404,7 +404,7 @@ export function LoginOverviewSection() {
|
||||
// back to its starting offset. The CSV-export button was
|
||||
// already in the toolbar row above the table wrapper.
|
||||
<>
|
||||
<div className="overflow-x-auto">
|
||||
<div className="relative overflow-x-auto">
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="text-muted-foreground border-b text-xs">
|
||||
|
||||
@@ -348,7 +348,7 @@ export function UserManagementSection() {
|
||||
`md:block hidden` swaps it out for the card-list below at
|
||||
`< md`. Hiding the table-only wrapper (instead of just
|
||||
the cells) saves DOM weight on mobile too. */}
|
||||
<div className="hidden overflow-x-auto md:block">
|
||||
<div className="relative hidden overflow-x-auto md:block">
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="text-muted-foreground border-b text-xs">
|
||||
|
||||
Reference in new issue
Block a user