Commit ddd841e
authored
feat(tldraw): redesign page menu (tldraw#8836)
This is a clean-history reimplementation of tldraw#8827 (branch
[`steve/page-menu-no-edit-mode`](https://github.com/tldraw/tldraw/tree/steve/page-menu-no-edit-mode))
— the final diff is byte-identical, but the work is split into three
reviewable commits instead of 24 incremental updates. Please review
here; tldraw#8827 has been closed in favor of this PR.
The page menu used to require flipping into an explicit edit mode to
rename pages or reorder them. This PR removes that mode entirely.
Reordering happens by dragging the row itself, renaming happens inline
(double-click, Enter, or the row submenu), and the popover gains a
draggable resize handle so the list height can be adjusted and persisted
across sessions.
https://github.com/user-attachments/assets/c9e0a4fc-e644-4134-b261-58c0515cf4a2
Closes tldraw#8814.
### Interactions
| Interaction | Before | After |
| ------------------ | ------------------------------------------ |
------------------------------------------- |
| Reorder a page | Toggle Edit, drag the dedicated handle | Drag the row
itself |
| Rename a page | Toggle Edit, click the field | Double-click the row,
press Enter, or use the kebab submenu |
| Current page mark | Checkmark icon | Subtle background pill (matches
dotcom sidebar) |
| Submenu trigger | Always visible | Hidden until row hover (and hidden
while renaming or dragging) |
| List height | Fixed | Drag the resize handle to adjust; double-click
it to reset to default. Persisted to localStorage. |
| Create page button | Header | Pinned to the bottom of the popover |
Renaming a non-current page no longer silently navigates to it. The
rename input matches the row's vertical metrics so the label doesn't
shift when editing, and blur commits the change.
### Commit storyline
1. **`feat(tldraw): redesign page menu`** — drop the edit-mode toggle,
switch to inline rename, move "Create new page" to a footer button,
replace the checkmark with a current-row pill, and add the
auto-scrolling drag-from-row reorder behavior (plus the coarse-pointer
drag handle).
2. **`feat(tldraw): make page menu list resizable and persist height`**
— add the resize handle, localStorage persistence, double-click to
reset, and the Radix-available-height cap.
3. **`test(e2e): extend overlay snapshot timeout for cold preview
runs`** — small unrelated stability tweak that the original branch
picked up along the way.
### Change type
- [x] `improvement`
### Test plan
1. Open the page menu with multiple pages.
2. Drag a row by its body — it should reorder without entering any mode.
3. Double-click a row's label (or press Enter / use the kebab menu) — it
should rename inline. Blur should commit.
4. Confirm the current page shows the highlight pill and renaming a
non-current page does not navigate.
5. Drag the resize handle at the bottom of the popover up and down;
reopen the menu and confirm the height is remembered.
6. Double-click the resize handle — the list should snap back to its
default height and forget the saved preference.
7. Open the page menu when the current page is far down the list — it
should scroll into view.
- [x] End to end tests
### Release notes
- Redesigned the page menu: reorder rows by dragging them directly,
rename inline by double-clicking or pressing Enter, and resize the page
list to remember your preferred height (double-click the resize handle
to reset it). The explicit edit mode has been removed.
### API changes
- Added `page-menu.resize` translation key for the resize handle's
accessible label.
- Removed unused `page-menu.max-page-count-reached` translation key.
### Code changes
| Section | LOC change |
| --------------- | ------------ |
| Core code | +663 / -498 |
| Tests | +115 / -69 |
| Automated files | +1 / -1 |1 parent 3748941 commit ddd841e
12 files changed
Lines changed: 779 additions & 568 deletions
File tree
- apps/examples/e2e
- tests
- assets/translations
- packages/tldraw
- src/lib
- ui
- components/PageMenu
- hooks/useTranslation
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | 12 | | |
14 | | - | |
| 13 | + | |
| 14 | + | |
15 | 15 | | |
16 | | - | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
5 | 33 | | |
6 | 34 | | |
7 | 35 | | |
| |||
49 | 77 | | |
50 | 78 | | |
51 | 79 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 80 | + | |
| 81 | + | |
58 | 82 | | |
59 | 83 | | |
60 | 84 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 85 | + | |
| 86 | + | |
67 | 87 | | |
68 | 88 | | |
69 | 89 | | |
70 | 90 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 91 | + | |
| 92 | + | |
77 | 93 | | |
78 | 94 | | |
79 | 95 | | |
| |||
100 | 116 | | |
101 | 117 | | |
102 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
103 | 140 | | |
104 | 141 | | |
105 | 142 | | |
| |||
246 | 283 | | |
247 | 284 | | |
248 | 285 | | |
249 | | - | |
250 | | - | |
251 | | - | |
| 286 | + | |
252 | 287 | | |
253 | 288 | | |
254 | 289 | | |
255 | 290 | | |
256 | | - | |
257 | | - | |
258 | | - | |
| 291 | + | |
259 | 292 | | |
260 | 293 | | |
261 | 294 | | |
| |||
289 | 322 | | |
290 | 323 | | |
291 | 324 | | |
292 | | - | |
293 | | - | |
294 | | - | |
| 325 | + | |
295 | 326 | | |
296 | 327 | | |
297 | 328 | | |
| |||
322 | 353 | | |
323 | 354 | | |
324 | 355 | | |
325 | | - | |
326 | | - | |
327 | | - | |
| 356 | + | |
328 | 357 | | |
329 | 358 | | |
330 | 359 | | |
331 | 360 | | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
| 361 | + | |
| 362 | + | |
338 | 363 | | |
339 | 364 | | |
340 | 365 | | |
341 | 366 | | |
342 | 367 | | |
343 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
344 | 390 | | |
345 | 391 | | |
346 | 392 | | |
347 | | - | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
348 | 396 | | |
349 | 397 | | |
350 | | - | |
351 | | - | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
| 398 | + | |
358 | 399 | | |
359 | 400 | | |
360 | | - | |
| 401 | + | |
361 | 402 | | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
369 | 406 | | |
370 | 407 | | |
371 | | - | |
372 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
373 | 411 | | |
374 | 412 | | |
375 | | - | |
376 | | - | |
377 | | - | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
378 | 420 | | |
379 | 421 | | |
380 | 422 | | |
| |||
399 | 441 | | |
400 | 442 | | |
401 | 443 | | |
402 | | - | |
| 444 | + | |
403 | 445 | | |
404 | 446 | | |
405 | 447 | | |
| |||
427 | 469 | | |
428 | 470 | | |
429 | 471 | | |
430 | | - | |
| 472 | + | |
431 | 473 | | |
432 | 474 | | |
433 | 475 | | |
| |||
459 | 501 | | |
460 | 502 | | |
461 | 503 | | |
462 | | - | |
| 504 | + | |
463 | 505 | | |
464 | 506 | | |
465 | 507 | | |
| |||
495 | 537 | | |
496 | 538 | | |
497 | 539 | | |
498 | | - | |
| 540 | + | |
499 | 541 | | |
500 | 542 | | |
501 | 543 | | |
| |||
538 | 580 | | |
539 | 581 | | |
540 | 582 | | |
541 | | - | |
| 583 | + | |
542 | 584 | | |
543 | 585 | | |
544 | 586 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
335 | 334 | | |
336 | 335 | | |
337 | 336 | | |
338 | 337 | | |
| 338 | + | |
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | | - | |
| 496 | + | |
0 commit comments