Draft
Conversation
When a user double-clicks a file in a workspace, the sibling leaf URIs (other files in the same folder, respecting the current sort order) are written to sessionStorage. The viewer tab reads these on mount via a useWorkspaceNavigation hook, enabling prev/next navigation through the sibling documents. This reuses the existing StatusBar prev/next buttons, falling back to workspace navigation when search result navigation is unavailable. - Add workspaceNavigation utility with storeWorkspaceSiblingUris, leafUrisOfChildren, findNodeById, and useWorkspaceNavigation hook - Pass columnsConfig to respect the user's chosen sort order - Wire workspace nav into Viewer via effectivePreviousFn/effectiveNextFn - Connect through PageViewerOrFallback for the /viewer/:uri route - Add tests for leafUrisOfChildren, findNodeById, storeWorkspaceSiblingUris
Move both previous and next buttons to the right-hand side of the toolbar, adjacent to each other, so the user doesn't have to move their pointer across the full width of the screen to cycle back and forth. Replace the subtle navigate-before/navigate-next chevron icons with filled triangle (play-arrow) icons for much better visibility. The previous button uses a CSS scaleX(-1) flip. - Add DocNavButton component with prominent 28x28px hit area - Add hover state with translucent white background - Inactive buttons render at 30% opacity - Add doc-nav-button CSS classes for the new design
Only render KeyboardShortcut components for next/previous document navigation when the effective navigation functions are defined, preventing Mousetrap from trying to bind undefined as a callback.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previous/next document navigation from workspaces
Partially addresses #470
When a user opens a document from a workspace, they can now use previous/next buttons (and
shift+left/shift+rightkeyboard shortcuts) to cycle through sibling documents in the same folder — matching the existing behaviour for cycling through search results.Why
Previously, the prev/next navigation only worked when a document was opened from search results. Users working through documents in a workspace had to go back to the workspace tab, click the next file, and wait for a new viewer tab to open. This is particularly tedious when reviewing many files in sequence.
How it works
sessionStorage.useWorkspaceNavigationhook reads the sibling URIs fromsessionStorageon mount and providesgoToPrevious/goToNextfunctions.This approach avoids any additional API calls — the workspace page already has the tree in memory, and
sessionStorageis scoped to the originating tab so there's no leakage to shared links.Design changes
The prev/next buttons have been redesigned:
Limitations
PageViewer(multi-page documents) doesn't yet have a footer toolbar, so prev/next only works for documents that fall back to the legacy viewer. This is being addressed separately - see Document view: consistent view mode switch UX, better wrapping sidebar #607