Share was hard to use on a phone: the “Who can read” menu was clipped so “Anyone with the link” could not be picked, avatar initials disappeared on the yellow fill, and Copy failed silently when the clipboard was denied. Dead share URLs still returned a page, mailed export links never expired, and failed /r/ lookups were not limited.
This change makes the access menu usable with mouse, touch, and keyboard, shows initials and a readable link with a copy confirmation, and adds a content security policy plus expiring export tokens.
Changes
Portal the Share access listbox to document.body and open it above the trigger when there is no room below, so both options stay on screen. Arrow / Home / End / Enter / Space move through the list. Options are at least 44px on phones. Escape stays inside the menu.
Filled avatars use dark initials on the yellow fill. The share URL is a read-only field (not a dimmed disabled input). Copy confirms with “Link copied” and a “Copied” button, with an execCommand fallback. Invite and Copy stay outline, not grey-disabled, when the email field is empty. A missing /r/[slug] returns 404.
Send a Content-Security-Policy (self, optional Umami origin, inline styles). Drop X-Powered-By. Mailed export links carry an expiry and a version; turning share off or removing a reader rotates the version so old mail stops working. Failed public share lookups are rate-limited before the database query.
On a short window the people list scrolls instead of squashing the two avatar rows. The pane uses the same scrollbar-design class as Create and Dialog.
Screenshots
How to Test
npm run storybook → Components / Modals / Share (Default and Anyone with the Link).
At 320, 390, 640, and 1280, open “Who can read this Rule” and pick Anyone with the link with mouse/touch. Both options must be fully visible and tappable.
Keyboard: open the menu, Arrow Up/Down, Home/End, Enter or Space to choose, Escape to close without leaving the dialog.
Confirm initials are readable on the yellow avatars. With a public link on, the URL is white-on-dark and selectable. Copy shows Link copied and the button Copied (try with clipboard denied).
Open a garbage /r/… slug and confirm a 404, not a titled empty page.
After npm run migrate:smoke, turn share off or remove a reader and confirm an old mailed export URL no longer downloads. Check response headers for CSP and no X-Powered-By.
Notes
Export-token TTL in code is seven days. Tokens rotate when share is turned off or a reader is removed.
Share slug length is unchanged; brute-force is handled with a miss rate limit instead.
CSP / token / rate-limit work has no UI. The gray track on a short-frame scrollbar is the shared scrollbar-design gutter (same as Create and Dialog); Figma’s scrollbar asset is only the 6px thumb.
The last Changes bullet (short-frame people list + scrollbar-design) is still unstaged on Share.view.tsx and Share.test.tsx until you commit it.
## Overview
Share was hard to use on a phone: the “Who can read” menu was clipped so “Anyone with the link” could not be picked, avatar initials disappeared on the yellow fill, and Copy failed silently when the clipboard was denied. Dead share URLs still returned a page, mailed export links never expired, and failed `/r/` lookups were not limited.
This change makes the access menu usable with mouse, touch, and keyboard, shows initials and a readable link with a copy confirmation, and adds a content security policy plus expiring export tokens.
## Changes
- Portal the Share access listbox to `document.body` and open it above the trigger when there is no room below, so both options stay on screen. Arrow / Home / End / Enter / Space move through the list. Options are at least 44px on phones. Escape stays inside the menu.
- Filled avatars use dark initials on the yellow fill. The share URL is a read-only field (not a dimmed disabled input). Copy confirms with “Link copied” and a “Copied” button, with an `execCommand` fallback. Invite and Copy stay outline, not grey-disabled, when the email field is empty. A missing `/r/[slug]` returns 404.
- Send a Content-Security-Policy (self, optional Umami origin, inline styles). Drop `X-Powered-By`. Mailed export links carry an expiry and a version; turning share off or removing a reader rotates the version so old mail stops working. Failed public share lookups are rate-limited before the database query.
- On a short window the people list scrolls instead of squashing the two avatar rows. The pane uses the same `scrollbar-design` class as Create and Dialog.
## Screenshots

## How to Test
1. `npm run storybook` → Components / Modals / Share (Default and Anyone with the Link).
2. At 320, 390, 640, and 1280, open “Who can read this Rule” and pick **Anyone with the link** with mouse/touch. Both options must be fully visible and tappable.
3. Keyboard: open the menu, Arrow Up/Down, Home/End, Enter or Space to choose, Escape to close without leaving the dialog.
4. Confirm initials are readable on the yellow avatars. With a public link on, the URL is white-on-dark and selectable. Copy shows **Link copied** and the button **Copied** (try with clipboard denied).
5. Open a garbage `/r/…` slug and confirm a 404, not a titled empty page.
6. After `npm run migrate:smoke`, turn share off or remove a reader and confirm an old mailed export URL no longer downloads. Check response headers for CSP and no `X-Powered-By`.
## Notes
- Export-token TTL in code is seven days. Tokens rotate when share is turned off or a reader is removed.
- Share slug length is unchanged; brute-force is handled with a miss rate limit instead.
- CSP / token / rate-limit work has no UI. The gray track on a short-frame scrollbar is the shared `scrollbar-design` gutter (same as Create and Dialog); Figma’s scrollbar asset is only the 6px thumb.
- The last Changes bullet (short-frame people list + `scrollbar-design`) is still unstaged on `Share.view.tsx` and `Share.test.tsx` until you commit it.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Overview
Share was hard to use on a phone: the “Who can read” menu was clipped so “Anyone with the link” could not be picked, avatar initials disappeared on the yellow fill, and Copy failed silently when the clipboard was denied. Dead share URLs still returned a page, mailed export links never expired, and failed
/r/lookups were not limited.This change makes the access menu usable with mouse, touch, and keyboard, shows initials and a readable link with a copy confirmation, and adds a content security policy plus expiring export tokens.
Changes
document.bodyand open it above the trigger when there is no room below, so both options stay on screen. Arrow / Home / End / Enter / Space move through the list. Options are at least 44px on phones. Escape stays inside the menu.execCommandfallback. Invite and Copy stay outline, not grey-disabled, when the email field is empty. A missing/r/[slug]returns 404.X-Powered-By. Mailed export links carry an expiry and a version; turning share off or removing a reader rotates the version so old mail stops working. Failed public share lookups are rate-limited before the database query.scrollbar-designclass as Create and Dialog.Screenshots
How to Test
npm run storybook→ Components / Modals / Share (Default and Anyone with the Link)./r/…slug and confirm a 404, not a titled empty page.npm run migrate:smoke, turn share off or remove a reader and confirm an old mailed export URL no longer downloads. Check response headers for CSP and noX-Powered-By.Notes
scrollbar-designgutter (same as Create and Dialog); Figma’s scrollbar asset is only the 6px thumb.scrollbar-design) is still unstaged onShare.view.tsxandShare.test.tsxuntil you commit it.