Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bench/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function sectionTrees(count: number, hosts: "sidebar" | "fixed" = "sidebar") {
"beforeend",
"<style>.gh-prism-tree { height: 100vh !important; }</style>",
);
const view = showSections(page, new AbortController().signal);
const view = showSections(page, new AbortController().signal, async () => undefined);
view.landed?.(NOTHING_PLACED);
settle();
const sectionsWith = (status: "modified" | "added", of = files) =>
Expand Down
9 changes: 5 additions & 4 deletions design/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ maintain its design direction.*

`design/` holds gh-prism's design direction: how its UI looks, moves, and words things
inside GitHub's pages. That UI is the sidebar, the header counter (the per-section
breakout of the lines-changed count, on a commit's page and a pull request's tabs), and
the dialog gh-prism opens on GitHub's classic Files changed page.
[`CONTEXT.md`](../CONTEXT.md) defines the domain terms these files use, such as section,
Viewed, and what's new. How a stylesheet is written, imported, and scoped is in
breakout of the lines-changed count, on a commit's page and a pull request's tabs), the
dialog gh-prism opens on GitHub's classic Files changed page, and the code owner details
dialog that a code-owner shield opens. [`CONTEXT.md`](../CONTEXT.md) defines the domain
terms these files use, such as section, Viewed, and what's new. How a stylesheet is
written, imported, and scoped is in
[`docs/agents/styling-rules.md`](../docs/agents/styling-rules.md).

## Routing
Expand Down
18 changes: 18 additions & 0 deletions design/decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ maintain its design direction.*
Each entry records one design pick: what was compared, what won, and why. Add new entries
at the top, dated.

## 2026-10-28: Code owner details in a dialog

- **Compared:**
- a shield's click: opening a dialog, or keeping the popover open with a "More" link;
- the dialog's mount: the page's body with its own stylesheet, or the sections view;
- the members listed per team: 10, 15, or 20;
- the popover's hint: a header line or a footer that stays put while the list scrolls,
reading "Click the shield for details" or "Click for more".
- **Won:** a dialog, mounted in the page's body, listing 15 members, with the hint in a
footer below a hairline reading "Click the shield for details".
- **Why:** the issue asks for the shield's click itself to open the details. A "More" link
would add a second step: a click that pins the popover, then a click on the link. A
dialog in the body serves a shield in the sidebar's shadow root and one on the
Conversation tab alike, so neither needs a second mount. 15 sits in the middle of the
requested 10 to 20. The footer keeps the heading and list where they were and stays
visible over a long folder list. "Click the shield" names what to click, since the
pointer may already have moved into the popover.

## 2026-10-28: A folder's code owners

- **Compared:** for a folder's shield, the spot over its icon, as a file's, and its row's
Expand Down
31 changes: 25 additions & 6 deletions design/patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,20 @@ An owned file's icon gives way to a shield while its row is hovered or focused,
folder's icon gives way to its chevron. The shield is Octicons `shield-lock`, muted at
rest and `--fgColor-default` on hover. Resting the pointer on it opens a popover listing
the file's code owners, with the code owner's files popup's timing below, and so does
focusing it. Clicking it, or Enter or Space on it, opens the popover and moves focus into
it, where it stays until Escape or a click outside. `sidebar/section-tree.css` swaps the
icon for the shield; `sidebar/owners-popover.ts` builds the popover.
focusing it. The popover ends in a footer that stays put while the list scrolls. Below a
hairline, the footer holds one small muted sentence, "Click the shield for details".
Clicking the shield, or Enter or Space on it, closes the popover and opens the code owner
details dialog (§ Dialogs). `sidebar/section-tree.css` swaps the icon for the shield;
`sidebar/owners-popover.ts` builds the popover.

A folder holding an owned file shows the same shield while its row is hovered or focused,
at its row's end, centred on the file rows' Viewed box column, because its icon already
gives way to its chevron. A flattened chain's shield stands for its deepest folder, which
holds the same files. `sidebar/section-tree.css` places it. Its popover lists every file
the section shows under that folder, nested ones included, each as a path relative to the
folder in monospace with its directory muted, with an owned file's code owners under it. A
file with none shows its path alone. `sidebar/owners-popover.ts` builds it.
file with none shows its path alone. It ends in the same hint, and a click on the shield
opens the code owner details dialog too. `sidebar/owners-popover.ts` builds it.

A folder chain short of room keeps its first folder and as many trailing folders as fit
around one `…`. With room for less, it shows `…` and the deepest folder alone. Only the
Expand Down Expand Up @@ -129,8 +132,8 @@ A floating surface draws one 1px edge, never two. An overlay draws no border of
because `--shadow-floating-small` opens with a 1px ring that draws its edge, as in
Primer's ActionMenu. Browsers give `[popover]` and `<dialog>` a default border, which
would add a second edge, so such an overlay clears it with `tw:[border:0]`. The code
owners popover does, and so does the classic notice in `classic/notice.ts`, which keeps
its own radius.
owners popover does, and so do the classic notice in `classic/notice.ts` and the code
owner details dialog in `ui/owners-dialog.ts`. Those two keep their own radius.

A hover card whose trigger sits next to one of GitHub's hovercard triggers takes GitHub's
hovercard form instead: the 1px `--borderColor-default` border, the medium radius, and no
Expand Down Expand Up @@ -161,6 +164,13 @@ and name keep GitHub's own hovercard, so the two cards never share a trigger.
under it says "Through" and names each team, linked to its team page, or "Directly and
through" when CODEOWNERS names them too. Then one row per file, its path in monospace
with the directory muted. A long list scrolls inside the popup.
- **The hint:** like a file row's code owners popover (§ File rows), the popup ends in a
footer that stays put while the list scrolls: below a hairline, "Click the shield for
details" in small muted text.
- **The click:** clicking the shield, or Enter or Space on it, closes the popup and opens
the code owner details dialog (§ Dialogs), headed by the code owner's `@user` or
`@org/team` name. Closing the dialog returns focus to the shield. Focus opens the popup
just as hover does, so the popup shows again.
- **When GitHub hides the team:** a code owner GitHub marks without letting you see which
team makes them one gets one plain muted sentence instead of the list.
- **The tooltip:** the classic shield's own GitHub tooltip ("… is a code owner") says
Expand Down Expand Up @@ -203,3 +213,12 @@ the reviewer can change it, how. `sidebar/sections-view.ts` holds them.
The classic-page dialog is a native `<dialog>`. It enters with Primer's scale-and-fade,
while the spectrum sweeps across its top edge, and its backdrop is Primer's
`--overlay-backdrop-bgColor`. `classic/notice.ts` and `classic/notice.css` hold it.

The code owner details dialog copies that dialog's shell, its header, ✕ button, entrance,
and backdrop, but has no spectrum and no footer buttons. ✕, Escape, and a click outside
close it. Under its heading, it repeats what the shield's popover lists, built by the same
code. Then each owning team gets a block below a hairline: its `@org/team` name linked to
its team page, then at most 15 members as `@login` links. A team with more members ends in
a "See all N members" link to its team page. A team the viewer can't see reads "GitHub
doesn't show you this team's members.", and an empty one reads "This team has no members."
`ui/owners-dialog.ts` and `ui/owners-dialog.css` hold it.
38 changes: 26 additions & 12 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,11 @@ once, through `readTeamMembers`, from the JSON GitHub's team mentions read, and
returns only a large team's first members. It reads members only when GitHub shows the
viewer a team among the PR reviewers, because a viewer outside the organization sees none
and gets 404 for every team. `index.ts` runs it on the PR reviewers once both reads land,
and hands every reader the result, so every reader sees the same teams.
and hands every reader the result, so every reader sees the same teams. `withMemberTeams`
and the code owner details dialog both read through the visit's `teamMembersReader`, so
the dialog reuses a read already made. Each read also carries the team's member count,
which the dialog's "See all N members" link shows when the team has more members than it
lists.

Each read settles on its own: one that fails, or whose response misses a field it expects,
resolves to `undefined` and logs one warning naming it, and the other read is unaffected.
Expand Down Expand Up @@ -292,18 +296,26 @@ once they land, and drops them if the page has gone. `SectionTree` in
[`sidebar/section-tree.ts`](../entrypoints/content/sidebar/section-tree.ts) marks each
owned file's rows in every section and every folder row above one, and the `@pierre/trees`
patch draws a shield beside each: a file's in place of its icon, a folder's at its row's
end, while the row is hovered or focused. Resting the pointer on a shield for 200 ms,
focusing it, or clicking it opens a popover listing the file's owners or, for a folder,
each file the section shows under it with that file's owners, built by
end, while the row is hovered or focused. Resting the pointer on a shield for 200 ms or
focusing it opens a popover listing the file's owners or, for a folder, each file the
section shows under it with that file's owners, built by
[`sidebar/owners-popover.ts`](../entrypoints/content/sidebar/owners-popover.ts) and
removed, with its listeners, once it closes. Hover and focus go through
`followHoverIntent`, as the Conversation popup's do, following each tree's shadow root,
because a move between a row and its shield never reaches the document. A popover that
hover or focus opened closes as the pointer or focus leaves; a click keeps it open with
focus inside. The sections view also closes it before moving into or out of the narrow
layout's overlay, since a popover that leaves the document closes without a toggle event.
A pointer click on the shield of a popover a click opened only closes it. Showing a file's
owners never changes its section or the diffstat.
hover or focus opened closes as the pointer or focus leaves. The sections view also closes
it before moving into or out of the narrow layout's overlay, since a popover that leaves
the document closes without a toggle event. Showing a file's owners never changes its
section or the diffstat.

Clicking a shield, or Enter or Space on it, closes the popover and opens the code owner
details dialog, built by
[`ui/owners-dialog.ts`](../entrypoints/content/ui/owners-dialog.ts). The dialog repeats
the popover's list, then shows each owning team's first 15 members and a link to the
team's page for the rest. It mounts in the page's body with its own stylesheet, so a
shield in a shadow root and one in the light DOM can share it. Opening it moves focus to
the shield's row first. The dialog then hands focus back to the row, never the shield,
whose focus would reopen the popover.

On the Conversation tab, a code-owner shield beside a PR reviewer in a Reviewers list
opens a popup listing the changed files that code owner owns, built by
Expand All @@ -318,8 +330,10 @@ gh-prism's own shield to every row whose PR reviewer owns a changed file, or who
marks a code owner, but has no shield, and takes it away from a row where GitHub later
draws its own. That shield is a button drawn as GitHub draws its own in that list, placed
just before the row's last icon, the status icon, where GitHub puts its shield. Hovering
or focusing either shield opens the popup. A click on either changes nothing: GitHub's
shield has no action of its own, and gh-prism's leaves its click free.
or focusing either shield opens the popup. A click on either closes the popup and opens
the code owner details dialog from `ui/owners-dialog.ts`. One click listener on the
document serves both shields, because GitHub replaces the classic sidebar's nodes
mid-visit, and a listener on a shield would go with them.

The popup lists the files `ownerFilter` gives the shield's `@user` or `@org/team` token,
counting the teams GitHub names for that reviewer, and names those teams, each linked to
Expand Down Expand Up @@ -440,7 +454,7 @@ entrypoints/
diffs/ diff order, reveal, j/k file keys, on-screen and Viewed tracking
header/ diffstat breakout
conversation/ a code owner's files popup and gh-prism's reviewer shield, in the Reviewers lists
ui/ shared DOM helpers, popup placer, hover intent, loading view, Markdown subset, name reveal, Tailwind tokens
ui/ shared DOM helpers, popup placer, hover intent, loading view, code owner details dialog, Markdown subset, name reveal, Tailwind tokens
utils/
github/ routes, diff parsing, the PR data port and source, code owners and reviewers
intent/ reading, caching, and landing intent
Expand Down
Loading
Loading