T12.2: CR-020 row selection in the User Directory

- A checkbox per row the caller may change; select-all covers only the
  rows the current filter and search show, and is indeterminate on a
  partial selection.
- Your own row and rows you cannot change show a disabled box whose
  label gives the reason.
- Changing the filter or the search clears the selection and says so
  in a live region (decided 2026-10-06), so no hidden row stays
  selected.
- The bulk bar appears at one or more selected rows and is hidden (out
  of the tab order) at zero. Actions arrive in T12.3.
- Selection is updated in place, not by re-rendering, so focus stays on
  the checkbox just used. One delegated listener; no ids in inline
  handlers.
- The email-width rule now targets td.ell, not nth-child(3), which the
  new column would have shifted.

Checked in a DOM harness (jsdom) against the real page and scripts:
14/14; against main the selection checks fail. Browser probe at
390px/1440px follows in T12.6.
This commit is contained in:
2026-10-06 11:01:02 -07:00
parent 0e79e17a57
commit cf46b3ce42
2 changed files with 159 additions and 5 deletions

View File

@@ -24,7 +24,10 @@
The directory is one wide table, so the column exceptions live here: email is
the one cell long enough to stretch a row, and the two role dropdowns need
room for "Assistant Project Manager" without pushing Actions off screen. */
#users-table table td:nth-child(3){ max-width:230px; overflow:hidden; text-overflow:ellipsis; }
/* The email cell, by its class: CR-020's selection column moved it from third to
fourth on the managers' table, and a position-based rule would have followed
the wrong column. */
#users-table table td.ell{ max-width:230px; overflow:hidden; text-overflow:ellipsis; }
#users-banner:not(:empty), #scope-banner:not(:empty){ margin-bottom:var(--s3); }
#nu-projects{ margin-top:var(--s2); }
#nu-projects .pickrow{ padding:var(--s1) var(--s1); }
@@ -33,6 +36,43 @@
#nu-project-list{ max-height:200px; overflow:auto; border:1px solid var(--border); }
.whoami-chip{ font-size:12px; color:var(--muted); }
.whoami-chip strong{ color:var(--text); }
/* CR-020: row selection and the bulk bar. Tokens only (the token rule). */
#sel-banner:not(:empty), #bulk-banner:not(:empty){ margin-bottom:var(--s3); }
#bulk-banner ul{ margin:var(--s1) 0 0; padding-left:var(--s5); font-weight:400; }
table.grid th.selcell, table.grid td.selcell{ width:1%; padding:0 var(--s1); text-align:center; }
/* The label is the hit area: the 16px box alone is under the 24px floor. */
.selhit{ display:inline-flex; align-items:center; justify-content:center;
min-width:28px; min-height:28px; cursor:pointer; }
.selhit input{ width:16px; height:16px; margin:0; accent-color:var(--accent); cursor:pointer; }
.selhit input:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.selhit input:disabled{ cursor:default; }
/* Not --accent-soft: that is the admin pill's own fill (console.css, hover note). */
table.grid tbody tr.is-selected td{ background:var(--cds-layer-selected); }
table.grid tbody tr.is-selected td.selcell{ box-shadow:inset 3px 0 0 var(--accent); }
.bulkbar{ border:1px solid var(--accent); border-left:3px solid var(--accent);
background:var(--surface); padding:var(--s2) var(--s3); margin:0 0 var(--s3); }
.bulkbar[hidden]{ display:none; }
.bulkhead{ display:flex; align-items:center; justify-content:space-between; gap:var(--s2);
flex-wrap:wrap; margin-bottom:var(--s2); }
.bulkgroup{ display:flex; flex-wrap:wrap; align-items:center; gap:var(--s2);
padding:var(--s2) 0; border-top:1px solid var(--border); }
.bulkgroup > .bulklabel{ font-size:12px; font-weight:600; color:var(--muted); min-width:110px; }
.bulkgroup select{ height:var(--ctl); padding:0 var(--s1) 0 var(--s2); font:inherit; font-size:13px;
border:1px solid var(--border-strong); border-radius:0; background:var(--surface); color:var(--text);
max-width:100%; }
.bulkgroup select:focus-visible{ outline:2px solid var(--accent); outline-offset:-2px; }
/* The bulk delete dialog lists every affected username; a long list scrolls
inside the dialog instead of pushing its buttons off the screen. */
#wp-dlg-msg{ max-height:50vh; overflow:auto; }
@media (max-width:620px){
.bulkgroup > .bulklabel{ min-width:0; flex:1 1 100%; }
.bulkgroup select, .bulkgroup button{ flex:1 1 100%; }
}
@media (pointer:coarse){
.selhit{ min-width:44px; min-height:44px; }
.bulkbar button, .bulkgroup select{ min-height:44px; }
}
</style>
</head>
<body>
@@ -63,8 +103,9 @@
<div class="sub" id="people-sub"></div>
<div class="toolbar">
<button onclick="loadUsers()">Refresh</button>
<input id="user-search" placeholder="Search name / username / email / job function…" oninput="renderUsers()">
<select id="user-filter" onchange="renderUsers()">
<input id="user-search" placeholder="Search name / username / email / job function…" oninput="filterChanged()"
aria-label="Search the directory">
<select id="user-filter" onchange="filterChanged()" aria-label="Show">
<option value="">Everyone</option>
<option value="active">Active only</option>
<option value="disabled">Disabled only</option>
@@ -72,6 +113,17 @@
</select>
</div>
<div id="users-banner"></div>
<!-- CR-020: bulk actions on the selected rows. Present only while at least one
row is selected (the hidden attribute also takes it out of the tab order). -->
<div id="bulk-bar" class="bulkbar" role="region" aria-label="Bulk actions on the selected users" hidden>
<div class="bulkhead">
<strong id="bulk-count">0 selected</strong>
<button type="button" onclick="clearSelection(true)">Clear selection</button>
</div>
<div id="bulk-actions"></div>
</div>
<div id="sel-banner"></div>
<div id="bulk-banner"></div>
<div id="users-table"><div class="note">Loading…</div></div>
</div>