Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Contacts: the letter index is a narrow strip on the list's edge

Yashwanth Kamireddi5457d7749dff
diff --git a/.uiverify/contacts-keys.mjs b/.uiverify/contacts-keys.mjs
index b8341bc..02a40bd 100644
--- a/.uiverify/contacts-keys.mjs
+++ b/.uiverify/contacts-keys.mjs
@@ -105,6 +105,14 @@ await p2.goto(process.env.URL ?? "http://localhost:4173", { waitUntil: "networki
await openScreen(p2, "Contacts");
await p2.waitForTimeout(800);
ok((await p2.locator(".contact-index button").count()) >= 26, "a long list has the letters down its edge");
+// The letters take a narrow strip at the list's edge, not a column beside its scroll bar.
+const room = await p2.evaluate(() => {
+ const wrap = document.querySelector(".contact-rows-wrap").getBoundingClientRect();
+ const row = document.querySelector(".contact-row").getBoundingClientRect();
+ const index = document.querySelector(".contact-index").getBoundingClientRect();
+ return { lost: Math.round(wrap.width - row.width), index: Math.round(index.width), edge: Math.round(wrap.right - index.right), overlap: row.right > index.left + 0.5 };
+});
+ok(room.index <= 16 && room.edge === 0 && room.lost <= 16 && !room.overlap, `the letters take a narrow strip at the edge, and the names nearly all the width ${JSON.stringify(room)}`);
await p2.locator(".contact-index button", { hasText: "M" }).click();
await p2.waitForTimeout(100);
const top = await p2.evaluate(() => {
diff --git a/src/screens/ContactsView.tsx b/src/screens/ContactsView.tsx
index e91881d..df3d442 100644
--- a/src/screens/ContactsView.tsx
+++ b/src/screens/ContactsView.tsx
@@ -1052,7 +1052,7 @@ export function ContactsView() {
)}
<div className="contact-rows-wrap">
<ul
- className={`contact-rows${listFocused ? " is-focused" : ""}`}
+ className={`contact-rows${listFocused ? " is-focused" : ""}${letters.length > 1 && overflowing ? " has-index" : ""}`}
ref={rowsRef}
// A list box of people: the open card is the selected option, or every picked one.
role="listbox"
diff --git a/src/styles/app.css b/src/styles/app.css
index db405e5..07c8dac 100644
--- a/src/styles/app.css
+++ b/src/styles/app.css
@@ -657,7 +657,7 @@
}
/* The list and the letter index beside it share what is left of the column's height. */
-.contact-rows-wrap { display: flex; flex: 1 1 auto; min-height: 0; }
+.contact-rows-wrap { position: relative; display: flex; flex: 1 1 auto; min-height: 0; }
/* With no one to show, the line saying so takes the column, centred as Notes centres its own —
after the rows' wrapper, which otherwise took the height and left it at the foot. */
.contact-rows-wrap:has(~ .empty-state) { flex: none; }
@@ -665,13 +665,20 @@
.contact-rows { position: relative; flex: 1 1 auto; min-width: 0; list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; }
/* A long address book lays out and paints only the rows in view. */
.contact-rows > li:not(.contact-letter) { content-visibility: auto; contain-intrinsic-size: auto 38px; }
+/* The letters ride the list's own trailing edge, as the phone and icloud.com draw them: one
+ narrow strip over the rows' inset, not a column of its own beside the list's scroll bar.
+ As its own column, with the bar between, it took about thirty pixels from every name. The
+ strip is how a long list is travelled, so the bar gives way to it while it is there. */
+.contact-rows.has-index { padding-right: 15px; scrollbar-width: none; }
+.contact-rows.has-index::-webkit-scrollbar { display: none; }
.contact-index {
- display: flex; flex-direction: column; justify-content: center; flex: none;
- width: 16px; margin-left: 2px; padding: 4px 0;
+ position: absolute; top: 0; right: 0; bottom: 0; z-index: 2;
+ display: flex; flex-direction: column; justify-content: center;
+ width: 15px; padding: 4px 0;
touch-action: none; user-select: none; -webkit-user-select: none;
}
.contact-index button {
- flex: 0 1 18px; min-height: 0; padding: 0; border: 0; background: none;
+ flex: 0 1 15px; min-height: 0; padding: 0; border: 0; background: none;
color: var(--accent-strong); font: inherit; font-size: var(--t-10); font-weight: 600; line-height: 1;
cursor: pointer;
}