fix(review): code and documentation review findings for 1.2.1
Two independent reviews, of the code and of the documentation against it.
Code:
- A first click on a row button or a chevron jumped the tree to the top:
handing focus to the tree with no row focused made it pick the first one.
The clicked control's row becomes the focused one, and the tree only picks
the first row for a focus that came from the keyboard — which also stops a
plain click on a row in a scrolled tree from landing on the wrong row.
- Three forced-colours rules lost to more specific ones: the selected theme
lost its label on hover, About's status-bar entry had no right edge, and a
drop into the focused folder showed nothing.
- Under a search, Alt+Up/Down announced the position among all siblings while
the row's aria-posinset counts the ones on screen; it announces the latter.
Moves run one at a time, and the live region is emptied before each
message so a repeated text is spoken.
- The preview's "Show more" was still 22 px; the ring on "Show earlier / Show
more" and on the "Move to…" folders was clipped; placeholders used the
browser's grey, which no contrast test saw.
- EditTab's script was over the 150-line limit: its live-sync wiring moves to
stores/edit-live.ts.
Documentation:
- ACCESSIBILITY.md promised more than the code does in nine places ("every
clickable target is 24 px", "nothing times out", "focus is always a 2-pixel
ring", four operating systems "supported"). Rewritten to what the source
supports; the untested list and the known limitations grew.
- docs/05, 06, 10, 11, 13, 15 and CLAUDE.md corrected where they named tests
that did not exist, miscounted, or were overtaken by the fixes above.
tests: a managed node, hidden siblings under a search and an in-flight move
for nudge; the statement's key table is checked against tree-keyboard.ts.
capture/about.png shows the new About link.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
8d9739cab4
commit
2be6955087
26 files changed
+408
-126
No files matched your search
+67
-35
@@ -32,16 +32,19 @@ The priorities, in order:
|
||||
|
||||
| Environment | Status |
|
||||
|---|---|
|
||||
| Chrome 136 or later on Windows, macOS, Linux and ChromeOS | Supported |
|
||||
| Edge, Brave, Vivaldi and Opera (the same build) | Best effort — it works, but is tested less |
|
||||
| Chrome 136 or later on Windows | Supported, and where the testing below was done |
|
||||
| Chrome 136 or later on macOS, Linux and ChromeOS | Supported; expected to work the same, not tested for accessibility |
|
||||
| Edge, Brave, Vivaldi and Opera (the same build) | Best effort — the extension runs there, and accessibility is untested |
|
||||
| Chrome on Android or iOS | Not applicable: Chrome there does not run extensions |
|
||||
|
||||
## What is in place
|
||||
|
||||
### Keyboard
|
||||
|
||||
Everything is reachable with Tab and Shift+Tab, and every dialog can be closed
|
||||
with Esc. Focus is always visible, as a 2-pixel ring.
|
||||
Every control is either a tab stop or has a key of its own, and every dialog
|
||||
can be closed with Esc. Focus shows as a 2-pixel ring on controls; inside the
|
||||
bookmark tree, the current row is marked by a highlight and a bar at its left
|
||||
edge.
|
||||
|
||||
The bookmark tree on the **Edit** tab is a single tab stop. Inside it:
|
||||
|
||||
@@ -54,14 +57,18 @@ The bookmark tree on the **Edit** tab is a single tab stop. Inside it:
|
||||
| A letter or digit | Jump to the next row whose title starts with it |
|
||||
| Enter | Open a bookmark in a new tab; open or close a folder |
|
||||
| F2 | Rename (Enter saves, Esc cancels) |
|
||||
| Delete | Delete, after a confirmation |
|
||||
| Delete (Fn+Delete on a Mac laptop) | Delete, after a confirmation |
|
||||
| Menu key, or Shift+F10 | **Move to…** — pick a destination folder from a filterable list |
|
||||
| Alt+↑ / Alt+↓ | Move the row up or down one place inside its folder |
|
||||
| Ctrl+C (⌘C on macOS) | Copy the focused bookmark's address |
|
||||
| Ctrl+F (⌘F on macOS) | Go to the search box, from anywhere on the Edit tab |
|
||||
|
||||
The small buttons that appear on a row are shortcuts for the mouse. Each has a
|
||||
key in the table above, so they are deliberately not tab stops.
|
||||
The small buttons that appear on a row are shortcuts for the mouse, and are
|
||||
deliberately not tab stops: Open, Copy link, Rename, Move to… and Delete each
|
||||
have a key in the table above, and Sort A→Z is also a button on the toolbar.
|
||||
|
||||
Alt+↑ and Alt+↓ move a row past the neighbour you can see. While a search is
|
||||
filtering the tree, that also carries it past any hidden items in between.
|
||||
|
||||
Elsewhere: the theme control is a radio group (arrow keys change the choice),
|
||||
the file drop zone is a button that opens the file picker, and the folder
|
||||
@@ -77,9 +84,12 @@ buttons and checkboxes — Tab, Enter and Space.
|
||||
opens with **Cancel** focused, so Enter never confirms a deletion.
|
||||
- An import is spoken as it goes: reading the file, backing up, writing,
|
||||
progress every 10 %, and the result. Failures are announced as alerts.
|
||||
- Moving a row with Alt+↑ or Alt+↓ speaks its new position.
|
||||
- When a step or a page replaces the one before it, focus moves to the new
|
||||
content instead of falling back to the top of the page.
|
||||
- Moving a row with Alt+↑ or Alt+↓ announces its new position ("Docs:
|
||||
position 2 of 5"). This is new in 1.2.1 and has not yet been checked with a
|
||||
screen reader — see "What has been tested".
|
||||
- When an import moves to its next step, focus moves to that step's heading.
|
||||
When a page change removes the control that had focus, focus moves to the
|
||||
page's main content rather than back to the top of the page.
|
||||
- Every icon-only button has a name. Icons themselves are hidden from
|
||||
assistive technology.
|
||||
- The page title names the current section, and the page's language follows
|
||||
@@ -88,26 +98,29 @@ buttons and checkboxes — Tab, Enter and Space.
|
||||
### Seeing the page
|
||||
|
||||
- **Contrast.** Text is at least 4.5:1 against its background, and control
|
||||
borders and the focus ring at least 3:1, in the light theme and both dark
|
||||
ones. A test fails the build if a colour pair drops below that.
|
||||
borders and the focus ring at least 3:1, in the light and the dark theme. A
|
||||
test fails the build if a colour pair drops below that.
|
||||
- **Contrast themes** (Windows "Contrast themes", `forced-colors`). Since
|
||||
1.2.1, the states that were shown only by a fill or a shadow — the focused
|
||||
row, the selected theme, the current section, the selected option cards,
|
||||
the progress bar — are drawn with system colours instead.
|
||||
- **Zoom.** The layout reflows as the window narrows or the page is zoomed;
|
||||
browser zoom up to 200 % is expected to work.
|
||||
row, where a dragged item will land, the selected theme, the current
|
||||
section, the selected option cards, the progress bar, the edge of the file
|
||||
drop zone — are drawn with the theme's own colours instead.
|
||||
- **Zoom.** The layout reflows as the window narrows or the page is zoomed.
|
||||
- **Light and dark** themes follow the system, or your choice in Settings.
|
||||
- **Disabled controls** are marked by colour and cursor, never by fading the
|
||||
text until it cannot be read.
|
||||
- **Target size.** Since 1.2.1, every clickable target is at least
|
||||
24 × 24 CSS pixels.
|
||||
- **Disabled buttons** are marked by colour and cursor, never by fading the
|
||||
text until it cannot be read. (Two kinds of button are an exception; see
|
||||
the limitations.)
|
||||
- **Target size.** Since 1.2.1, every button is at least 24 × 24 CSS pixels,
|
||||
including the small icon buttons. Checkboxes, radio buttons and links in
|
||||
text keep their natural size; their labels are part of the target.
|
||||
|
||||
### Motion
|
||||
|
||||
If your system asks for reduced motion, nothing moves: no sliding, spinning or
|
||||
travelling stripes. A test fails the build if an animation is added outside
|
||||
that rule. Nothing flashes, and nothing times out while you are reading — an
|
||||
error message stays until you dismiss it.
|
||||
that rule. Nothing flashes. An error message stays until you dismiss it;
|
||||
short confirmations leave by themselves after four seconds (see the
|
||||
limitations below).
|
||||
|
||||
## What has been tested
|
||||
|
||||
@@ -116,11 +129,13 @@ error message stays until you dismiss it.
|
||||
| Keyboard only, mouse unplugged | Chrome on Windows 11 | November 2026, version 1.2.0 |
|
||||
| Screen reader | **Narrator** with Chrome on Windows 11 | November 2026, version 1.2.0 |
|
||||
| Contrast themes | Chrome with `forced-colors` emulated — not yet a real Windows theme | November 2026, version 1.2.1 |
|
||||
| Colour contrast, reduced motion, the tree's key handling, focus rings | Automated tests, on every change | Continuous |
|
||||
| What 1.2.1 changed: focus, Alt+↑/↓, button sizes | A scripted keyboard run in Chrome — no screen reader | November 2026, version 1.2.1 |
|
||||
| Colour contrast of the theme colours, reduced motion, the tree's key handling | Automated tests, on every change | Continuous |
|
||||
|
||||
**Not tested**, so we cannot tell you how well they work: NVDA, JAWS,
|
||||
VoiceOver on macOS, ChromeVox on ChromeOS, Orca on Linux, voice control
|
||||
(Dragon, Voice Access, Voice Control), switch access, and screen magnifiers.
|
||||
**Not tested**, so we cannot tell you how well they work: anything on macOS,
|
||||
Linux or ChromeOS; NVDA, JAWS, VoiceOver, ChromeVox and Orca; voice control
|
||||
(Dragon, Voice Access, Voice Control); switch access; screen magnifiers; and
|
||||
zoom at 200 %. Narrator has not yet been run over what 1.2.1 added.
|
||||
If you use one of these, a report of what you found — good or bad — is
|
||||
genuinely useful.
|
||||
|
||||
@@ -128,9 +143,11 @@ genuinely useful.
|
||||
|
||||
These are known, and none of them is by design.
|
||||
|
||||
- **Most edits are not announced.** Alt+↑/↓ speaks the result; a rename, a
|
||||
move to another folder, a sort, a new folder and "keep the first of each"
|
||||
succeed silently. Search does not announce how many rows match.
|
||||
- **Most edits are not announced.** Alt+↑/↓ announces the result; a rename, a
|
||||
move to another folder, a sort and a new folder succeed silently. Search
|
||||
does not announce how many rows match. A key that cannot act — Alt+↑ on the
|
||||
first item of a folder, Delete on one of the three top-level folders — does
|
||||
nothing and says nothing.
|
||||
- **Folders and bookmarks sound alike in the tree.** They differ by an icon a
|
||||
screen reader does not read. A folder with something in it announces
|
||||
"expanded" or "collapsed"; an empty folder announces neither. The lock on a
|
||||
@@ -141,17 +158,32 @@ These are known, and none of them is by design.
|
||||
- **Reordering with a pointer needs a drag.** There is a keyboard way
|
||||
(Alt+↑/↓) and Sort A→Z, but no click-only way to place one item before
|
||||
another.
|
||||
- **The tree's keys are not shown inside the extension.** The table above is
|
||||
the list; the About tab links to this file.
|
||||
- **Some hints appear only on mouse hover**: the notes in the status bar, and
|
||||
the reason a section is unavailable while an import is writing.
|
||||
- **Alt+↑/↓ may not reach the page on a Chromebook**, where the system can turn
|
||||
those keys into Page Up and Page Down. On a Mac there is no Menu key (use
|
||||
Shift+F10), and the laptop's delete key is Backspace, which the tree does
|
||||
not act on (use Fn+Delete).
|
||||
- **The tree's keys are not shown inside the extension**, apart from Ctrl+F on
|
||||
the search box. The table above is the list; the About tab links to this
|
||||
file.
|
||||
- **The toolbar above the tree is announced as a toolbar**, but its buttons are
|
||||
reached with Tab, not with the arrow keys a toolbar usually offers.
|
||||
- **Some hints appear only on mouse hover**: the notes in the status bar, where
|
||||
a top-level folder of an imported file will go, and the reason a section is
|
||||
unavailable while an import is writing.
|
||||
- **A section that is unavailable while an import is writing looks the same as
|
||||
one that is available**; only the cursor and the hover hint differ. The same
|
||||
goes for a tree row's small buttons while a sort or a bulk delete is
|
||||
running. A screen reader does announce both as unavailable.
|
||||
- **Long titles are cut short with "…"** in the tree, and there is no way to
|
||||
read the whole title there other than renaming (F2).
|
||||
- **Headings are sparse.** Sections are landmarks, but the pages have few
|
||||
headings to jump between, and there is no "skip to content" link past the
|
||||
header's controls.
|
||||
- **Descriptions in Settings are not tied to their controls**, so a screen
|
||||
reader reads the control's name but not the sentence under it.
|
||||
- **Short notices disappear after four seconds** ("Saved", "Link copied").
|
||||
They are announced, but they cannot be paused.
|
||||
- **Short notices disappear after four seconds** ("Saved", "Link copied",
|
||||
the name of an exported file). They are announced, but they cannot be
|
||||
paused. An error stays, though a second error replaces the first.
|
||||
- **Text size follows zoom, not the browser's font-size setting.** Use
|
||||
Ctrl and + to enlarge the page.
|
||||
- **On the Edit tab, Ctrl+F always goes to BookmarkMagic's own search box**
|
||||
|
||||
@@ -11,7 +11,8 @@ This file is the entry point; the `docs/` suite is the specification.
|
||||
> 2026-10-28; v1.1.0 live, confirmed on the listing 2026-11-06; v1.2.0 live,
|
||||
> confirmed on the listing 2026-11-10; v1.2.1 prepared 2026-11-10, ⚠️ not yet
|
||||
> submitted).
|
||||
> Phases 0–9 are complete; the project is in **maintenance**.
|
||||
> Phases 0–8 are complete and Phase 9 (v1.2.1) is prepared; the project is in
|
||||
> **maintenance**.
|
||||
> That changes the rules of the game:
|
||||
>
|
||||
> - Every change now reaches installed users through a store review. It needs a
|
||||
@@ -172,7 +173,9 @@ checksum-verified zip). A finding worth keeping: on this Windows machine the
|
||||
process-spawning script tests time out intermittently under load (`main`'s
|
||||
too), so CI — whose Windows smoke job passed — was the gate.
|
||||
✔ Live on the store, confirmed on the listing 2026-11-10 (5 languages).
|
||||
Human-only ⚠️, still open: the native review passes.
|
||||
Human-only ⚠️, still open: the native review passes, and `13 §1b` step 10 —
|
||||
the published build installed on a clean profile — which has no recorded
|
||||
result for any version.
|
||||
|
||||
### Phase 9 — v1.2.1: accessibility
|
||||
The owner's keyboard-only and Narrator pass over 1.2.0 found nothing; an audit
|
||||
@@ -188,7 +191,9 @@ Two things to carry forward. **`ACCESSIBILITY.md` is a public promise**: a UI
|
||||
change that makes its key table or its known-limitations list false has to
|
||||
change the file in the same PR (`11 §5` has the check). And the statement's
|
||||
goal is WCAG 2.2 AA **as a goal** — never write "conforms" or "compliant"
|
||||
without an audit to cite.
|
||||
without an audit to cite. The review found the first draft of the statement
|
||||
overclaiming in nine places ("every clickable target", "nothing times out"):
|
||||
check each sentence of it against the source, not against the intention.
|
||||
**Exit:** v1.2.1 prepared 2026-11-10. Human-only ⚠️: the `11 §5` pass with the
|
||||
**1.2.0 → 1.2.1 upgrade over an existing profile**, a real Windows contrast
|
||||
theme and a screen-reader pass over Alt+↑/↓, the zip upload, and the native
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 75 KiB |
@@ -190,7 +190,7 @@ tree key was ignored.
|
||||
|---|---|
|
||||
| Search | input (debounced 150 ms) → core filter on title+URL → tree shows matches with ancestors expanded; a folder the user collapses during the search stays collapsed until the search text changes |
|
||||
| Rename | F2 or the row button → inline input, focused with its text selected; Enter or blur commits, Esc cancels (a blur after Esc does not commit), and after Enter or Esc focus returns to the tree → trimmed; blank or unchanged → nothing; else `bookmarks.update(id, { title })` |
|
||||
| Move | drag & drop onto a row — before, after or into (`planDrop`, `05 §10`) → `bookmarks.move(id, { parentId, index })`, or `{ parentId }` alone into a folder; "Move to…" (row button, menu key / Shift+F10) → modal folder list with a filter → `bookmarks.move(id, { parentId })`, appended; **Alt+↑ / Alt+↓** on the tree (since v1.2.1) → `nudgeTarget` picks the sibling shown above or below, then the same `planDrop` (before / after) and the same `moveTo` as a drag — no second write path. The command reports the item's new place among its siblings, which the tab speaks (`06 §5`) |
|
||||
| Move | drag & drop onto a row — before, after or into (`planDrop`, `05 §10`) → `bookmarks.move(id, { parentId, index })`, or `{ parentId }` alone into a folder; "Move to…" (row button, menu key / Shift+F10) → modal folder list with a filter → `bookmarks.move(id, { parentId })`, appended; **Alt+↑ / Alt+↓** on the tree (since v1.2.1) → `nudgeTarget` picks the sibling shown above or below, then the same `planDrop` (before / after) and the same `moveTo` as a drag — no second write path. One move at a time. The command reports the row's new place among the siblings on screen — the same "n of m" as its `aria-posinset` — which the tab speaks (`06 §5`) |
|
||||
| Delete | Del or the row button → confirm dialog (folder shows descendant count) → `removeTree` / `remove`; when the deleted row had focus, focus moves to the next row, else the previous. A copy deleted from the duplicate panel leaves the tree's focus where it was |
|
||||
| New folder | toolbar button → `bookmarks.create({ parentId, title })` in the focused folder, beside a focused bookmark, else in the first writable root → inserted at once unless its live event got there first (Chrome fires `onCreated` before `create` resolves, so either may win), a search that would hide it cleared, and every folder above it opened as the user's own — so clearing the search cannot close them again → inline rename |
|
||||
| Sort A→Z | toolbar (the focused folder, or the focused bookmark's folder) or a folder row's button → `planSort` (`05 §10`) → confirm stating how many items move → one awaited `bookmarks.move(id, { parentId, index })` per planned move, yielding every 25, under the write lock (§5). Refused part-way → "moved d of t" and a re-read: there is no undo |
|
||||
|
||||
+23
-7
@@ -403,18 +403,34 @@ nudgeTarget(rows, id, direction): // rows: the visible rows, in order; dire
|
||||
return neighbour.id
|
||||
|
||||
nudge(id, direction):
|
||||
a nudge already in flight → nothing // a held key repeats faster than a move completes
|
||||
target = nudgeTarget(rows, id, direction); none → nothing
|
||||
plan = planDrop(roots, id, target, direction < 0 ? 'before' : 'after'); none → nothing
|
||||
moveTo(id, plan)
|
||||
return { position: plan.position.local + 1, total: the parent's child count }
|
||||
moveTo(id, plan); refused → nothing
|
||||
row = the row for id, as it is now
|
||||
return { position: row.posInSet, total: row.setSize } // among the siblings ON SCREEN
|
||||
```
|
||||
|
||||
Visible siblings, not all of them, because that is what a drag does too: the
|
||||
user places the item relative to a row they can see. A permanent root has no
|
||||
`parentId` that `planDrop` accepts, so it never moves. Asserted in
|
||||
`tree-keyboard.test.ts` (ends of a folder, a collapsed neighbour's children
|
||||
skipped, a filtered list) and `edit-session.test.ts` (Chrome's index rule in
|
||||
both directions, a root, a managed node, while busy).
|
||||
user places the item relative to a row they can see. Under a search that has
|
||||
a consequence: the row passes its visible neighbour **and every hidden item
|
||||
between them**, so down-then-up restores what is on screen but not
|
||||
necessarily the hidden order. The place it reports is the visible one too —
|
||||
the same "n of m" the row's `aria-posinset`/`aria-setsize` give — so what is
|
||||
spoken and what the tree says cannot disagree. A permanent root has no
|
||||
`parentId` that `planDrop` accepts, so it never moves.
|
||||
|
||||
One at a time, because each plan is made from the optimistic tree: a second
|
||||
plan made before the first move has landed is made from a tree that is about
|
||||
to change. A residue is known and unfixed: the first move's live event can
|
||||
flush a frame after a second press's optimistic patch and roll the row back
|
||||
for that frame; the tree converges once the events drain (`15`, backlog).
|
||||
|
||||
Asserted in `tree-keyboard.test.ts` (ends of a folder, an open neighbour's
|
||||
children stepped over, a filtered list, a root's neighbour) and
|
||||
`edit-session.test.ts` (Chrome's index rule in both directions, a root, a
|
||||
managed node, hidden items under a search, one move at a time, while busy, a
|
||||
refusal).
|
||||
|
||||
## 11. Live-sync batching — `edit/live-sync.ts`
|
||||
|
||||
|
||||
+26
-7
@@ -462,8 +462,11 @@ held failures at the head of the one queue instead, and every later toast —
|
||||
or down among its siblings (§3.3); **Ctrl/⌘+C** copies the focused
|
||||
bookmark's link. Ctrl/⌘+F focuses search from anywhere in the tab. Keys
|
||||
typed into the rename input belong to it. `ACCESSIBILITY.md` carries the
|
||||
same list for users, and the About tab links to it — nothing in the UI shows
|
||||
these keys yet.
|
||||
same list for users, and the About tab links to it — apart from "Ctrl F" on
|
||||
the search box, nothing in the UI shows these keys yet. Tabbing in with
|
||||
nothing focused focuses the first row; a **mouse** press does not (since
|
||||
v1.2.1): the press focuses the list too, and choosing the first row then
|
||||
scrolled a long tree to the top under the pointer.
|
||||
- **Focus never dangles.** A focused row that leaves the screen hands focus to
|
||||
its nearest visible folder (`03 §3`). After a delete, focus goes back where
|
||||
the delete was asked for — the tree, or in the duplicate panel the next
|
||||
@@ -483,10 +486,12 @@ held failures at the head of the one queue instead, and every later toast —
|
||||
After a confirmed **Sort A→Z** from the toolbar — whose button is disabled
|
||||
while the sort runs, which is what dropped it — focus goes to the tree.
|
||||
- **The tree says what Alt+↑/↓ did.** One always-present polite live region in
|
||||
the tab speaks "<title>: position n of m" after each move. The row's
|
||||
`aria-posinset` changes too, but a screen reader does not re-read the active
|
||||
descendant for an attribute change, so without the region the move is
|
||||
silent.
|
||||
the tab speaks "<title>: position n of m" after each move — n and m being
|
||||
the row's own `aria-posinset` and `aria-setsize`, so under a search they
|
||||
count the siblings on screen, as the tree does. The attributes change too,
|
||||
but a screen reader does not re-read the active descendant for an attribute
|
||||
change, so without the region the move is silent. The region is emptied
|
||||
before each message: set to the text it already holds, it would say nothing.
|
||||
- **Dialogs** (`Modal`): the × is named "Dismiss" — it was named after the
|
||||
dialog, so a screen reader announced the cancel button as "Delete this
|
||||
item?" — and a confirmation's body is its `aria-describedby`, so the counts
|
||||
@@ -500,6 +505,8 @@ held failures at the head of the one queue instead, and every later toast —
|
||||
a row's own control, and so one click used to switch the arrow keys off
|
||||
until the next click on a row. It also means "Move to…" opened from the row
|
||||
button returns focus to the tree, not to a button on a row that has moved.
|
||||
With no row focused yet, the clicked control's row becomes the focused one,
|
||||
so the keys start from where the click was.
|
||||
- Drag & drop has keyboard parity: **into a folder** is "Move to…", and
|
||||
**before/after a sibling** is Alt+↑ / Alt+↓, one place at a time (since
|
||||
v1.2.1; through 1.2.0 Sort A→Z was the only keyboard reorder). What is still
|
||||
@@ -563,7 +570,19 @@ held failures at the head of the one queue instead, and every later toast —
|
||||
- **Target size:** every pointer target is at least 24 × 24 CSS px (WCAG 2.2,
|
||||
2.5.8) — since v1.2.1 the row buttons (were 22), the three disclosure
|
||||
chevrons (16), the toast and dialog dismiss buttons, the popup's gear and
|
||||
the pickers' "Show more". The glyphs keep their size; the hit area grows.
|
||||
"Show more" in the export picker and the import preview. The glyphs keep
|
||||
their size; the hit area grows. "Every target" means every button: native
|
||||
checkboxes and radios keep the browser's size inside a label that is the
|
||||
target, and links in running text are exempt by the criterion itself.
|
||||
- **A ring that would be clipped is drawn inside.** The tree's frame and the
|
||||
"Move to…" list clip their overflow, and the global ring sits 2px outside
|
||||
the control: on "Show earlier / Show more" and on the folder buttons it was
|
||||
cut off. Those use `outline-offset: -2px`.
|
||||
- **Placeholders use `--fg-muted`**, set once in `base.css`. The browser's
|
||||
default placeholder grey is not a token, so `contrast.test.ts` never saw it
|
||||
— about 4:1 on `--bg-sunken`.
|
||||
- **The selected theme segment keeps its label on hover.** `button:hover`
|
||||
outranks `.selected`, and `--fg` on the accent fill is under 3:1.
|
||||
- **The public statement is `ACCESSIBILITY.md`** at the repository root: the
|
||||
goal (WCAG 2.2 AA — a goal, not a conformance claim), what was tested and
|
||||
with what, the known limitations, and how to report a barrier. This section
|
||||
|
||||
@@ -82,8 +82,11 @@ rather than assign `undefined`. Build nodes with conditional spreads
|
||||
accessibility warnings (`a11y_*` — a click handler with no key handler, a
|
||||
control with no label) are warnings, and through 1.2.0 a warning never
|
||||
failed anything. It is the only lint that reads the markup. A deliberate
|
||||
exception takes a `<!-- svelte-ignore a11y_… -->` with its reason beside it;
|
||||
there are two, on `Modal`'s backdrop click and on the tree's `<ul>`.
|
||||
exception takes a `<!-- svelte-ignore a11y_… -->` with its reason in the
|
||||
same comment; there are two, on `Modal`'s backdrop click and on the tree's
|
||||
`<ul>`. (`TreeRow`'s row `<div>` avoids the same warning differently — an
|
||||
empty `onkeydown` and `role="presentation"` — because the keys are the
|
||||
tree's, not the row's.)
|
||||
- **Markdown and YAML are excluded since Biome 2.6**, which started formatting
|
||||
both. The docs and workflow files are laid out by hand (long explanatory
|
||||
comments, deliberate wrapping); letting a formatter own them would turn every
|
||||
|
||||
+20
-11
@@ -231,15 +231,23 @@ them is tested where it lives:
|
||||
hand-maintained, like the contrast pairs.
|
||||
- **`edit/tree-keyboard.test.ts`**, **`edit/tree-keys.test.ts`** and
|
||||
**`stores/edit-session.test.ts`** — since v1.2.1 also Alt+↑/↓ (`05 §10`):
|
||||
`nudgeTarget` at both ends of a folder, past a collapsed folder, in a
|
||||
filtered list; the key reaching the command only with Alt alone; the move
|
||||
itself by Chrome's index rule, refused for a root, a managed node and while
|
||||
busy, and returning the new position.
|
||||
`nudgeTarget` at both ends of a folder, stepping over an open neighbour's
|
||||
children, in a filtered list; the key reaching the command only with Alt
|
||||
alone; the move itself by Chrome's index rule, refused for a root, a managed
|
||||
node and while busy, one at a time, and returning the row's place among the
|
||||
siblings on screen — under a search too, where it passes hidden items.
|
||||
- **`components/focus-heading.test.ts`** — since v1.2.1 also
|
||||
`focusOwningTree`: a click on a row's control hands focus to the tree it
|
||||
sits in, and does nothing outside one.
|
||||
- **`links.test.ts`** — since v1.2.1 also `ACCESSIBILITY.md`: the file exists,
|
||||
the About link ends at it, and the README links to it.
|
||||
- **`links.test.ts`** — since v1.2.1 also `ACCESSIBILITY.md`: the file exists
|
||||
and the About link ends at it.
|
||||
- **`accessibility-statement.test.ts`** (v1.2.1) — the statement is a public
|
||||
promise nothing in the build reads, so its routes and its key table are
|
||||
pinned: the README links to it; the issue form exists and carries the
|
||||
`accessibility` label; the address is the same in the statement, the README
|
||||
and the issue chooser; every key `tree-keyboard.ts` switches on has a row;
|
||||
it states a goal and an untested list, and it is dated. It cannot tell
|
||||
whether a sentence is *true* — that is `§5`'s last item.
|
||||
- **`tests/unit/scripts/`** — the repo's own gates, tested like code. New in
|
||||
v1.1.0: `guard.test.ts` (`08 §3`), `check-manifest.test.ts` (a correct build
|
||||
passes, one without the CSP fails) and `sanitize-formats.test.ts` (the
|
||||
@@ -324,14 +332,15 @@ storage, nothing written survives a reload, and the popup's tiles open nothing.
|
||||
chevron with the mouse, the arrow keys still work.
|
||||
- [ ] **Focus is never lost:** Tab to the theme control — the ring is visible
|
||||
on the selected segment, in the header and in `#settings`, in both
|
||||
themes. "Open in Edit" from an import report, "Keep the first of each"
|
||||
and a toolbar Sort A→Z each leave focus somewhere visible; the next Tab
|
||||
does not start from the top of the page.
|
||||
themes. After "Keep the first of each" and after a toolbar Sort A→Z,
|
||||
focus is on something visible. After "Open in Edit" from an import
|
||||
report it is on the page's main region, which shows no ring: the test is
|
||||
that the next Tab goes into the tab's content, not back to the header.
|
||||
- [ ] **Screen reader** (Narrator on Windows, or NVDA; VoiceOver on macOS):
|
||||
the tree announces each row's name, level and "n of m"; a dialog reads
|
||||
its title and body; the import's steps and outcome are spoken; Alt+↓
|
||||
speaks the row's new position. Record the reader and its version in
|
||||
`ACCESSIBILITY.md`'s "Tested with" if it is a new one.
|
||||
speaks the row's new position, once. Record the reader and its version
|
||||
in `ACCESSIBILITY.md`'s "What has been tested".
|
||||
- [ ] **Contrast themes** (Windows: Settings → Accessibility → Contrast
|
||||
themes; or DevTools → Rendering → `forced-colors: active`): the tree's
|
||||
focused row, the drop line of a drag, the selected theme segment, the
|
||||
|
||||
@@ -49,6 +49,10 @@ privacy and distribution tabs are already filled; you are replacing the package.
|
||||
new `[X.Y.Z]` line must be added). Forgetting the link refs is the easy
|
||||
half to miss.
|
||||
|
||||
A third when the interface changed, or a new check was run:
|
||||
- `ACCESSIBILITY.md` — its "Last reviewed" line (date and version) and its
|
||||
"What has been tested" table, once `11 §5`'s last item has been done.
|
||||
|
||||
`wxt.config.ts` declares no `version` key — WXT derives it from
|
||||
`package.json` (`08 §5`). If it appears in your diff, something is wrong.
|
||||
3. PR → CI green → merge to `main`. **The bump must be on `main` before the
|
||||
@@ -178,6 +182,11 @@ actually shows and correct the files, not the dashboard.
|
||||
requires a sanitized sample (`scripts/sanitize-bookmarks.mjs`) plus explicit
|
||||
consent to commit it as a GPL-3.0 fixture, because that is what turns a report
|
||||
into a regression test (`11 §2`, `15 §v1.0.x`).
|
||||
- Accessibility reports — their own form (`accessibility.yml`, label
|
||||
`accessibility`) and `accessibility@poli0981.dev` for people without a
|
||||
GitHub account. `ACCESSIBILITY.md` promises an acknowledgement within about
|
||||
a week and a patch for a blocking barrier (`15`, release trigger); a report
|
||||
that is not fixed at once goes into its Known limitations.
|
||||
- Discord servers (`#support` in the OSS server) — pin an FAQ post.
|
||||
⚠️ The invite URL is not recorded anywhere in the repo.
|
||||
- Review flow for feature requests: label → roadmap doc PR → milestone.
|
||||
|
||||
+23
-7
@@ -181,8 +181,9 @@ was not measured, and NVDA, JAWS and VoiceOver remain untested).
|
||||
|
||||
### Accessibility backlog (from the 2026-11-10 audit, not closed in v1.2.1)
|
||||
|
||||
`ACCESSIBILITY.md` lists these as known limitations; this is where they are
|
||||
scheduled. None blocks a task; each is a patch when it lands (`12 §4`).
|
||||
`ACCESSIBILITY.md` lists the user-facing ones as known limitations; this is
|
||||
where they are scheduled. None blocks a task; each is a patch when it lands
|
||||
(`12 §4`).
|
||||
|
||||
- **Spoken results for the other edit commands.** Only Alt+↑/↓ announces what
|
||||
it did. A move, a sort, a rename, "keep first" and a new folder are silent
|
||||
@@ -201,8 +202,8 @@ scheduled. None blocks a task; each is a patch when it lands (`12 §4`).
|
||||
- **Hover-only hints** (`title` on elements that cannot take focus): the
|
||||
status bar's notes, the import target note, the busy reason on a disabled
|
||||
tab.
|
||||
- **Headings and a skip link.** No route has an `<h1>`, `#edit` has no
|
||||
headings, and the header's seven tab stops cannot be skipped. Landmarks
|
||||
- **Headings and a skip link.** Only the legal gate has an `<h1>`, `#edit` has
|
||||
no headings, and the header's five tab stops cannot be skipped. Landmarks
|
||||
exist.
|
||||
- **Settings descriptions** are not tied to their controls
|
||||
(`aria-describedby`), nor is the "dedupe is off under Replace" note.
|
||||
@@ -212,7 +213,20 @@ scheduled. None blocks a task; each is a patch when it lands (`12 §4`).
|
||||
- **Ctrl/⌘+F always goes to the search box** on `#edit`, even with a dialog
|
||||
open.
|
||||
- **No automated check of the rendered markup** — no axe pass, no role
|
||||
queries; the harness photographs but does not inspect.
|
||||
queries; the harness photographs but does not inspect. (A process gap, so
|
||||
not in the statement.) The forced-colours and focus-ring tests are
|
||||
file-level text checks: they cannot see specificity, which is how three of
|
||||
the 1.2.1 review's findings got past them.
|
||||
- **Disabled without a visual cue.** The section tabs during a write, and a
|
||||
row's buttons during a bulk command, change only the cursor.
|
||||
- **Keys that cannot act are silent** — Alt+↑ at the top of a folder, Delete on
|
||||
a root. And on a Mac laptop the delete key is Backspace, which the tree
|
||||
does not handle; on ChromeOS Alt+↑/↓ may arrive as Page Up/Down.
|
||||
- **Truncated titles** have no way to be read in full in the tree.
|
||||
- **A held Alt+↑/↓ can flicker.** Moves run one at a time, but the live event
|
||||
of one can flush a frame after the next press's optimistic patch and roll
|
||||
the row back for that frame (`05 §10`). It converges; the fix is to drain
|
||||
the batcher before planning.
|
||||
|
||||
## v1.2 — languages (planned 2026-11-06)
|
||||
|
||||
@@ -376,6 +390,8 @@ attempted.
|
||||
| 2026-11-10 | **v1.2.0 is live; v1.2.1 is accessibility.** The owner's keyboard-only and Narrator pass over 1.2.0 found nothing, and an audit of `src/` then found five things such a pass cannot see or did not reach: a focus ring drawn in the colour of the fill under it, no forced-colours support, reordering that only a drag could do, focus dropped on `<body>` in three places, and targets under 24 px. A pass by one person with one screen reader is evidence, not a verdict — which is also why the statement says what was tested and what was not | 06 §5, 11 §5 |
|
||||
| 2026-11-10 | **An accessibility statement, at the repository root.** `ACCESSIBILITY.md`, beside `SECURITY.md` and `CONTRIBUTING.md`, linked from the README and from About. It states **WCAG 2.2 AA as the goal, not as a conformance claim**: nobody has audited the product, and a claim would be the kind of sentence `14` exists to keep out of the project. Known limitations are listed in it rather than left in this backlog, because a user deciding whether the product will work for them reads that file, not this one | 06 §5, 15 |
|
||||
| 2026-11-10 | **`accessibility@poli0981.dev` for barrier reports**, the eleventh per-purpose alias (created and tested by the owner). It appears in `ACCESSIBILITY.md`, the README's contact table and the issue chooser — never in `src/`, by the 2026-08-03 rule, which the About link respects by pointing at the file instead. Reports have their own issue form and an `accessibility` label, because a barrier report needs the assistive technology and its version, which the bug form does not ask for | 06 §3.5, 13 §6 |
|
||||
| 2026-11-10 | **Alt+↑ / Alt+↓ reorders, and it is a patch.** It reuses `planDrop` and `moveTo`, so a keyboard move and a drag cannot disagree about what is legal, and there is no second write path to test. One place at a time, among the siblings on screen, like a drag. It ships in a patch because it closes a barrier to something the product already did rather than adding a capability; `12 §4` now says so. Rejected: "Move up / Move down" row buttons (a seventh and eighth button on a row that already hides six), and a position field in "Move to…" (a new dialog flow for the same result) — though a click-only route is still owed (WCAG 2.5.7, backlog) | 05 §10, 12 §4 |
|
||||
| 2026-11-10 | **Svelte's accessibility warnings fail the build.** `svelte-check --fail-on-warnings`: the `a11y_*` checks are compiler warnings, a warning never failed anything, and Biome does not read `.svelte` — so nothing linted the markup. The suite was at zero warnings, which is the only cheap moment to turn it on | 10 §3, 12 §2 |
|
||||
| 2026-11-10 | **The review of 1.2.1 found what the tests could not, again.** Twelve code findings and seventeen in the docs — among them a tree that jumped to the top on the first click of a row button (the fix for one focus defect causing another), three forced-colours rules that lost to more specific ones, and an accessibility statement that promised more than the code did: "every clickable target is 24 px", "nothing times out", "focus is always a 2-pixel ring". The statement was rewritten to what the source supports, and its untested list grew. A statement written by the author of the code needs the same adversarial read as the code | 11 §5 |
|
||||
| 2026-11-10 | **Alt+↑ / Alt+↓ reorders, and it is a patch.** It reuses `planDrop` and `moveTo`, so a keyboard move and a drag cannot disagree about what is legal, and there is no second write path to test. One place at a time, among the siblings on screen, like a drag. It ships in a patch because it closes a barrier to something the product already did rather than adding a capability; `12 §4` now says so. Rejected: "Move up / Move down" row buttons (two more on a row that already hides up to five), and a position field in "Move to…" (a new dialog flow for the same result) — though a click-only route is still owed (WCAG 2.5.7, backlog) | 05 §10, 12 §4 |
|
||||
| 2026-11-10 | **Focus after a route change goes to `<main>`, not to the tree.** "Open in Edit" removes the button that was clicked. Focusing the tree when `#edit` mounts would also have fired on every first load, highlighting a row nobody chose and changing every screenshot; a route change with focus lost is the narrower condition and covers every tab | 06 §5 |
|
||||
| 2026-11-10 | **Dependabot's bumps are not the whole bump.** #31 and #36 moved Biome twice and left `biome.json`'s `$schema` behind both times, and left `vitest` a minor behind the coverage plugin that must match it; `01 §2` drifted with them. The sync is a human step after each Dependabot merge, and WXT still gets the built-manifest diff — 0.21.5 produced a manifest byte-identical to the 1.2.0 release asset | 01 §2, §6 |
|
||||
| 2026-11-10 | **Dependabot's bumps are not the whole bump.** #31 and #36 moved Biome twice and left `biome.json`'s `$schema` behind both times, and left `vitest`'s declared range a minor behind the coverage plugin's, which must match it (the lockfile had both at 5.1.0); `01 §2` drifted with them. The sync is a human step after each Dependabot merge, and WXT still gets the built-manifest diff — 0.21.5 produced a manifest byte-identical to the 1.2.0 release asset | 01 §2, §6 |
|
||||
@@ -2,17 +2,17 @@
|
||||
/**
|
||||
* The #edit tab — docs/03 §3, docs/06 §3.3. Markup and wiring only: state
|
||||
* and commands live in `stores/edit-session.svelte.ts`, live events in
|
||||
* `edit/live-sync.ts`, the dialogs' markup in `EditDialogs.svelte`.
|
||||
* `edit/live-sync.ts` (wired by `stores/edit-live.ts`), the dialogs' markup
|
||||
* in `EditDialogs.svelte`.
|
||||
*/
|
||||
import { onMount, tick, untrack } from 'svelte';
|
||||
import { subscribe } from '../browser/bookmarks';
|
||||
import { copyToClipboard } from '../browser/clipboard';
|
||||
import { openBookmarkUrl } from '../browser/open-url';
|
||||
import { displayTitle, toEditNode } from '../edit/edit-node';
|
||||
import { createBatcher } from '../edit/live-sync';
|
||||
import { displayTitle } from '../edit/edit-node';
|
||||
import { type EditNode, findNode } from '../edit/patch-tree';
|
||||
import { onTreeKey } from '../edit/tree-keys';
|
||||
import { getLocale, num, t } from '../i18n/index.svelte';
|
||||
import { connectLive } from '../stores/edit-live';
|
||||
import { EditSession } from '../stores/edit-session.svelte';
|
||||
import { pushToast } from '../stores/toast.svelte';
|
||||
import DuplicatePanel from './DuplicatePanel.svelte';
|
||||
@@ -31,36 +31,10 @@
|
||||
|
||||
onMount(() => {
|
||||
void session.load();
|
||||
// One patch per frame, and a single re-read for bursts — an import in
|
||||
// another tab sends an event per node (docs/03 §3 "Live sync").
|
||||
const batcher = createBatcher({
|
||||
onFlush: session.applyLiveEvents,
|
||||
onBurst: () => void session.load(),
|
||||
});
|
||||
let importing = false;
|
||||
// Listeners attach on enter and detach on leave: a tab left subscribed
|
||||
// during an import would take one event per created node.
|
||||
const unsubscribe = subscribe({
|
||||
onCreated: (_id, node) => {
|
||||
if (importing || node.parentId === undefined) return;
|
||||
batcher.push({ kind: 'created', parentId: node.parentId, index: node.index, node: toEditNode(node) });
|
||||
},
|
||||
onRemoved: (id) => batcher.push({ kind: 'removed', id }),
|
||||
onChanged: (id, changes) => batcher.push({ kind: 'changed', id, changes }),
|
||||
onMoved: (id, info) => batcher.push({ kind: 'moved', id, ...info }),
|
||||
onChildrenReordered: () => batcher.resync(),
|
||||
onImportBegan: () => {
|
||||
importing = true;
|
||||
},
|
||||
onImportEnded: () => {
|
||||
importing = false;
|
||||
batcher.resync();
|
||||
},
|
||||
});
|
||||
const disconnect = connectLive(session);
|
||||
globalThis.addEventListener('keydown', onWindowKeydown);
|
||||
return () => {
|
||||
unsubscribe();
|
||||
batcher.dispose();
|
||||
disconnect();
|
||||
session.dispose();
|
||||
globalThis.removeEventListener('keydown', onWindowKeydown);
|
||||
};
|
||||
@@ -115,6 +89,10 @@
|
||||
async function nudge(id: string, direction: -1 | 1): Promise<void> {
|
||||
const placed = await session.nudge(id, direction);
|
||||
if (placed === undefined) return;
|
||||
// Emptied first: a region set to the text it already holds says nothing,
|
||||
// and two rows of one name can land on one position.
|
||||
announcement = '';
|
||||
await tick();
|
||||
announcement = t('edit.movedPosition', {
|
||||
title: displayTitle(findNode(session.roots, id), t('edit.untitled')),
|
||||
position: num(placed.position),
|
||||
|
||||
@@ -85,7 +85,9 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_noninteractive_element_interactions -->
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events, a11y_no_noninteractive_element_interactions —
|
||||
the click is the backdrop's (it lands on the dialog element), a pointer
|
||||
shortcut for what Esc and the Dismiss button already do from the keyboard. -->
|
||||
<dialog
|
||||
bind:this={dialog}
|
||||
class:danger
|
||||
|
||||
@@ -107,6 +107,11 @@
|
||||
background: var(--accent-subtle);
|
||||
}
|
||||
|
||||
/* Inset: the list scrolls, so it clips the global ring drawn outside. */
|
||||
button:focus-visible {
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
.label {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
function act(run: () => void): (event: MouseEvent) => void {
|
||||
return (event) => {
|
||||
event.stopPropagation();
|
||||
// With no row focused yet, this one is: the tree would otherwise start
|
||||
// its arrow keys from the top, a screenful away from the click.
|
||||
session.focusedId ??= node.id;
|
||||
focusOwningTree(event.currentTarget);
|
||||
run();
|
||||
};
|
||||
|
||||
@@ -118,8 +118,12 @@
|
||||
theme replaces (docs/06 §5). A border, not an outline — the focus ring is
|
||||
the outline — and not a fill, which Chrome's text backplate would cover. */
|
||||
@media (forced-colors: active) {
|
||||
footer button[aria-current='page'] {
|
||||
/* `nav .cell`, to outrank the `:last-child` rule that removes About's
|
||||
right edge; the padding gives back what the border takes, so the bar
|
||||
does not change height between routes. */
|
||||
footer nav .cell[aria-current='page'] {
|
||||
border: 2px solid Highlight;
|
||||
padding: 2px 6px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -130,6 +130,12 @@
|
||||
color: var(--accent-fg);
|
||||
}
|
||||
|
||||
/* `button:hover` above is the more specific rule, and --fg on the accent
|
||||
fill is under 3:1: hovering the chosen segment dimmed its own label. */
|
||||
.selected:hover {
|
||||
color: var(--accent-fg);
|
||||
}
|
||||
|
||||
/* The inset ring sits ON the selected segment's fill — and roving focus only
|
||||
ever lands on the selected segment. In --accent it was accent on accent:
|
||||
no visible focus at all (docs/06 §5). Drawn 2px further in, so the fill
|
||||
@@ -145,7 +151,8 @@
|
||||
paints a backplate in the page colour behind forced text, which left
|
||||
"Light" as a black box on the highlight. */
|
||||
@media (forced-colors: active) {
|
||||
.selected {
|
||||
.selected,
|
||||
.selected:hover {
|
||||
forced-color-adjust: none;
|
||||
background: Highlight;
|
||||
color: HighlightText;
|
||||
|
||||
@@ -76,9 +76,16 @@
|
||||
win = next(follow(win, focusIndex, rows.length), rows.length);
|
||||
}
|
||||
|
||||
/** Tabbing in with nothing focused focuses the first row, so arrows work at once (uL6). */
|
||||
/**
|
||||
* Tabbing in with nothing focused focuses the first row, so arrows work at
|
||||
* once (uL6). Only for a focus that came from the keyboard: a mouse press on
|
||||
* a row in a scrolled tree focuses this list too, and picking the first row
|
||||
* then scrolled the tree to the top under the pointer — the click that
|
||||
* followed landed on whatever row had moved there.
|
||||
*/
|
||||
function onFocus(): void {
|
||||
if (session.focusedId === undefined) session.focusedId = rows[0]?.node.id;
|
||||
if (session.focusedId !== undefined || element?.matches(':focus-visible') !== true) return;
|
||||
session.focusedId = rows[0]?.node.id;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -88,7 +95,9 @@
|
||||
{tPlural('edit.showEarlier', Math.min(range.from, WINDOW))}
|
||||
</button>
|
||||
{/if}
|
||||
<!-- svelte-ignore a11y_no_noninteractive_element_interactions -->
|
||||
<!-- svelte-ignore a11y_no_noninteractive_element_interactions — the tree
|
||||
pattern: the focusable `role="tree"` list IS the widget that takes the
|
||||
keys, with the active row named by aria-activedescendant. -->
|
||||
<ul
|
||||
bind:this={element}
|
||||
class="tree"
|
||||
@@ -177,4 +186,10 @@
|
||||
.more:hover {
|
||||
background: var(--accent-subtle);
|
||||
}
|
||||
|
||||
/* Inset: `.frame` clips its overflow, and the global ring sits 2px outside
|
||||
the button — on these two it was cut off on every side. */
|
||||
.more:focus-visible {
|
||||
outline-offset: -2px;
|
||||
}
|
||||
</style>
|
||||
@@ -163,6 +163,7 @@
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--accent);
|
||||
cursor: pointer;
|
||||
padding: 1px var(--sp-2);
|
||||
/* 24 px tall: an 18 px line, 2 px of padding, the border (WCAG 2.5.8). */
|
||||
padding: 2px var(--sp-2);
|
||||
}
|
||||
</style>
|
||||
@@ -98,6 +98,7 @@
|
||||
// this button, keeps the keyboard (docs/06 §5).
|
||||
event.stopPropagation();
|
||||
session.toggle(node.id);
|
||||
session.focusedId ??= node.id;
|
||||
focusOwningTree(event.currentTarget);
|
||||
}}
|
||||
/>
|
||||
@@ -193,6 +194,12 @@
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
/* After `.focused`: a drop INTO the focused folder must still show. */
|
||||
.drop-into {
|
||||
outline: 2px dashed Highlight;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
|
||||
/* A line laid over the row's edge: a real border would change the row's
|
||||
height mid-drag and move the very zones the drop is measured against. */
|
||||
.drop-before::after,
|
||||
|
||||
@@ -22,6 +22,13 @@ export interface TreeKeyEffects {
|
||||
nudge: (id: string, direction: -1 | 1) => void;
|
||||
}
|
||||
|
||||
/** Alt alone with ↑ or ↓: Alt+Shift+↓, AltGr and the like belong to the browser or the OS. */
|
||||
function nudgeDirection(event: KeyboardEvent): -1 | 1 | undefined {
|
||||
if (!event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return undefined;
|
||||
if (event.key === 'ArrowUp') return -1;
|
||||
return event.key === 'ArrowDown' ? 1 : undefined;
|
||||
}
|
||||
|
||||
export function onTreeKey(
|
||||
event: KeyboardEvent,
|
||||
session: EditSession,
|
||||
@@ -37,10 +44,8 @@ export function onTreeKey(
|
||||
effects.copy(focused);
|
||||
return;
|
||||
}
|
||||
// Alt alone: Alt+Shift+↓ and the like belong to the browser or the OS.
|
||||
if (event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) {
|
||||
const direction = event.key === 'ArrowUp' ? -1 : event.key === 'ArrowDown' ? 1 : undefined;
|
||||
if (direction === undefined || session.focusedId === undefined) return;
|
||||
const direction = nudgeDirection(event);
|
||||
if (direction !== undefined && session.focusedId !== undefined) {
|
||||
event.preventDefault();
|
||||
effects.nudge(session.focusedId, direction);
|
||||
return;
|
||||
|
||||
@@ -124,7 +124,7 @@ export default {
|
||||
sortPartial:
|
||||
'Đã di chuyển {done} trong số {total} mục trước khi trình duyệt từ chối. Thư mục đang hiển thị đúng thứ tự thực tế.',
|
||||
alreadySorted: 'Thư mục này đã được sắp xếp.',
|
||||
movedPosition: '{title}: vị trí {position} trên {total}',
|
||||
movedPosition: '{title}: vị trí thứ {position} trên {total}',
|
||||
},
|
||||
settings: {
|
||||
autosave: 'Thay đổi được lưu ngay khi bạn chỉnh.',
|
||||
|
||||
@@ -56,7 +56,7 @@ export interface BulkProgress {
|
||||
/** A failed command, shown above the tree rather than replacing it. */
|
||||
export type ActionError = DescribedError & { partial?: BulkProgress };
|
||||
|
||||
/** Where a moved row ended up among its siblings, 1-based — what the tab speaks. */
|
||||
/** Where a moved row ended up among the siblings on screen, 1-based — what the tab speaks. */
|
||||
export interface Placement {
|
||||
position: number;
|
||||
total: number;
|
||||
@@ -86,6 +86,8 @@ export class EditCommands extends EditView {
|
||||
busy = $state(false);
|
||||
/** Where the pending delete was asked for. */
|
||||
private deleteOrigin: DeleteOrigin = 'tree';
|
||||
/** An Alt+↑/↓ move is in flight. */
|
||||
private nudging = false;
|
||||
|
||||
protected readonly api: EditApi;
|
||||
protected readonly locale: () => string;
|
||||
@@ -241,18 +243,29 @@ export class EditCommands extends EditView {
|
||||
* the sibling shown above or below and hands it to the drag's own planner,
|
||||
* so a key and a drag cannot disagree about what is legal.
|
||||
*
|
||||
* @returns where the row now sits, for the tab to speak; `undefined` when
|
||||
* nothing moved — an end of the folder, a root, a managed node, busy.
|
||||
* One at a time: a held key repeats faster than a move completes, and a
|
||||
* second plan made before the first has landed is made from a tree that is
|
||||
* about to change.
|
||||
*
|
||||
* @returns where the row now sits among the siblings on screen — the same
|
||||
* "n of m" its `aria-posinset` and `aria-setsize` say, so under a search
|
||||
* the spoken place and the tree's agree; `undefined` when nothing moved —
|
||||
* an end of the folder, a root, a managed node, busy.
|
||||
*/
|
||||
nudge = async (id: string, direction: -1 | 1): Promise<Placement | undefined> => {
|
||||
if (this.nudging) return undefined;
|
||||
const target = nudgeTarget(this.rows, id, direction);
|
||||
if (target === undefined) return undefined;
|
||||
const plan = planDrop(this.roots, id, target, direction < 0 ? 'before' : 'after');
|
||||
if (plan?.position === undefined || !(await this.moveTo(id, plan))) return undefined;
|
||||
return {
|
||||
position: plan.position.local + 1,
|
||||
total: findNode(this.roots, plan.parentId)?.children?.length ?? 0,
|
||||
};
|
||||
if (plan?.position === undefined) return undefined;
|
||||
this.nudging = true;
|
||||
try {
|
||||
if (!(await this.moveTo(id, plan))) return undefined;
|
||||
} finally {
|
||||
this.nudging = false;
|
||||
}
|
||||
const row = this.rows.find((candidate) => candidate.node.id === id);
|
||||
return row === undefined ? undefined : { position: row.posInSet, total: row.setSize };
|
||||
};
|
||||
|
||||
/** A drag released on `targetId`; every illegal or no-op drop does nothing. */
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* The #edit tab's live sync, wired — docs/03 §3 "Live sync", docs/05 §11.
|
||||
*
|
||||
* Purpose: subscribe an `EditSession` to the browser's bookmark events for as
|
||||
* long as the tab is mounted. Out of EditTab so the component stays markup
|
||||
* and wiring (docs/10 §1); the batching itself is `edit/live-sync.ts`.
|
||||
* Guarantees: one patch per frame, and a single re-read for a burst — an
|
||||
* import in another tab sends an event per node. Listeners attach on enter
|
||||
* and detach on leave: a tab left subscribed during an import would take one
|
||||
* event per created node.
|
||||
*/
|
||||
import { subscribe } from '../browser/bookmarks';
|
||||
import { toEditNode } from '../edit/edit-node';
|
||||
import { createBatcher } from '../edit/live-sync';
|
||||
import type { EditSession } from './edit-session.svelte';
|
||||
|
||||
/** @returns the teardown: unsubscribe, and drop anything still queued. */
|
||||
export function connectLive(session: EditSession): () => void {
|
||||
const batcher = createBatcher({
|
||||
onFlush: session.applyLiveEvents,
|
||||
onBurst: () => void session.load(),
|
||||
});
|
||||
let importing = false;
|
||||
const unsubscribe = subscribe({
|
||||
onCreated: (_id, node) => {
|
||||
if (importing || node.parentId === undefined) return;
|
||||
batcher.push({
|
||||
kind: 'created',
|
||||
parentId: node.parentId,
|
||||
index: node.index,
|
||||
node: toEditNode(node),
|
||||
});
|
||||
},
|
||||
onRemoved: (id) => batcher.push({ kind: 'removed', id }),
|
||||
onChanged: (id, changes) => batcher.push({ kind: 'changed', id, changes }),
|
||||
onMoved: (id, info) => batcher.push({ kind: 'moved', id, ...info }),
|
||||
onChildrenReordered: () => batcher.resync(),
|
||||
onImportBegan: () => {
|
||||
importing = true;
|
||||
},
|
||||
onImportEnded: () => {
|
||||
importing = false;
|
||||
batcher.resync();
|
||||
},
|
||||
});
|
||||
return () => {
|
||||
unsubscribe();
|
||||
batcher.dispose();
|
||||
};
|
||||
}
|
||||
@@ -36,6 +36,14 @@ a {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
/* The browser's default placeholder grey is not one of our tokens, so the
|
||||
contrast test never saw it: about 4:1 on --bg-sunken. --fg-muted is a tested
|
||||
pair on every surface (docs/06 §1). */
|
||||
::placeholder {
|
||||
color: var(--fg-muted);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* Mono for anything machine-shaped: counts, versions, paths, addresses. */
|
||||
code,
|
||||
kbd,
|
||||
|
||||
@@ -43,7 +43,7 @@ describe('the accessibility statement', () => {
|
||||
'| A letter or digit |',
|
||||
'| Enter |',
|
||||
'| F2 |',
|
||||
'| Delete |',
|
||||
'| Delete (Fn+Delete on a Mac laptop) |',
|
||||
'| Menu key, or Shift+F10 |',
|
||||
'| Alt+↑ / Alt+↓ |',
|
||||
'| Ctrl+C (⌘C on macOS) |',
|
||||
@@ -52,6 +52,34 @@ describe('the accessibility statement', () => {
|
||||
for (const key of keys) expect(statement, `missing ${key}`).toContain(key);
|
||||
});
|
||||
|
||||
it('has a row for every key the tree’s code handles', () => {
|
||||
// The other direction: a key ADDED to the code without a row here fails.
|
||||
// `resolveKey` switches on these names; `tree-keys.ts` handles the rest.
|
||||
const ROWS: Record<string, string> = {
|
||||
ArrowDown: '| ↑ / ↓ |',
|
||||
ArrowUp: '| ↑ / ↓ |',
|
||||
Home: '| Home / End |',
|
||||
End: '| Home / End |',
|
||||
ArrowRight: '| → |',
|
||||
ArrowLeft: '| ← |',
|
||||
Enter: '| Enter |',
|
||||
F2: '| F2 |',
|
||||
Delete: '| Delete',
|
||||
ContextMenu: '| Menu key, or Shift+F10 |',
|
||||
};
|
||||
const source = read('src/lib/edit/tree-keyboard.ts');
|
||||
const cases = [...source.matchAll(/case '([A-Za-z0-9]+)':/g)].map((match) => match[1] ?? '');
|
||||
expect(cases.length).toBeGreaterThanOrEqual(Object.keys(ROWS).length);
|
||||
for (const key of cases) {
|
||||
const row = ROWS[key];
|
||||
expect(
|
||||
row,
|
||||
`tree-keyboard.ts handles ${key}, which has no row in ACCESSIBILITY.md`,
|
||||
).toBeDefined();
|
||||
expect(statement).toContain(row ?? '');
|
||||
}
|
||||
});
|
||||
|
||||
it('states a goal and says what was not tested, rather than claiming conformance', () => {
|
||||
expect(statement).toContain('That is a goal, not a claim.');
|
||||
expect(statement).toContain('**Not tested**');
|
||||
|
||||
@@ -153,6 +153,53 @@ describe('EditSession — Alt+↑ / Alt+↓ (v1.2.1)', () => {
|
||||
expect(fake.countCalls('move')).toBe(0);
|
||||
});
|
||||
|
||||
it('never moves a policy-managed node', async () => {
|
||||
const managed = fake.addManagedRoot();
|
||||
await session.load();
|
||||
expect(session.rows.some((row) => row.node.id === managed.id)).toBe(true);
|
||||
expect(await session.nudge(managed.id, -1)).toBeUndefined();
|
||||
expect(await session.nudge(managed.id, 1)).toBeUndefined();
|
||||
expect(fake.countCalls('move')).toBe(0);
|
||||
});
|
||||
|
||||
it('under a search, passes the hidden items too and reports the place the tree shows', async () => {
|
||||
const titles = ['zz one', 'plain', 'plainer', 'zz two', 'zz three'];
|
||||
const ids = titles.map((t, i) => fake.seed('1', { title: t, url: `https://n${i}.test/` }));
|
||||
await session.load();
|
||||
session.setQuery('zz');
|
||||
session.debounced = 'zz';
|
||||
expect(session.rows.filter((row) => row.parentId === '1').map((row) => row.node.title)).toEqual(
|
||||
['zz one', 'zz two', 'zz three'],
|
||||
);
|
||||
// Past its visible neighbour — and so past the two hidden items between.
|
||||
// The place reported is the one the tree shows: 2 of the 3 rows on screen,
|
||||
// which is what the row's aria-posinset says, not 4 of 5.
|
||||
expect(await session.nudge(ids[0] ?? '', 1)).toEqual({ position: 2, total: 3 });
|
||||
expect(fake.childTitles('1')).toEqual(['plain', 'plainer', 'zz two', 'zz one', 'zz three']);
|
||||
});
|
||||
|
||||
it('runs one move at a time: a second press while the first is in flight does nothing', async () => {
|
||||
const [a] = seedThree();
|
||||
let release: () => void = () => {};
|
||||
const gate = new Promise<void>((resolve) => {
|
||||
release = resolve;
|
||||
});
|
||||
const move = fake.move;
|
||||
fake.move = async (...args) => {
|
||||
await gate;
|
||||
await move(...args);
|
||||
};
|
||||
session = new EditSession(api(fake), () => 'en');
|
||||
await session.load();
|
||||
const first = session.nudge(a ?? '', 1);
|
||||
expect(await session.nudge(a ?? '', 1)).toBeUndefined();
|
||||
release();
|
||||
expect(await first).toEqual({ position: 2, total: 3 });
|
||||
expect(fake.childTitles('1')).toEqual(['b', 'a', 'c']);
|
||||
// And the next one goes through.
|
||||
expect(await session.nudge(a ?? '', 1)).toEqual({ position: 3, total: 3 });
|
||||
});
|
||||
|
||||
it('does nothing while a bulk command runs, and reports a refusal as no move', async () => {
|
||||
const [a] = seedThree();
|
||||
await session.load();
|
||||
|
||||
Reference in new issue
Block a user