You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[ENHANCEMENT] Improve canvas user experience with new tooltips and legend display - #858
Adds a tooltip inside the canvas to make navigation easier for users. The issue where the preview doesn't show the
whole display is not solved in code, but the new tooltip shows a shortcut to "fit everything in view," which should
help mitigate it.
Screenshots
New tooltip for canvas shortcuts (legend with long values also visible):
New tooltip for edge thicknes section:
Checklist
Pull request has a descriptive title and context useful to a reviewer.
Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the
following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, DOC,IGNORE.
adrianSepiol
changed the title
[ENHANCEMENT] Improve canvas user experience with new tooltips
[ENHANCEMENT] Improve canvas user experience with new tooltips and legend display
Oct 5, 2026
…for truncated legend labels'
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Adrian <56292595+adrianSepiol@users.noreply.github.com>
Hard-coding grey[700] makes this information icon low-contrast against the default dark-theme surface. Use a semantic, theme-aware foreground color so the icon remains visible in both light and dark modes.
Document required fitView/resetView and useZoom implementation
canvas/src/utils/shortcuts.ts:16
This comment overstates the single-source guarantee: adding a definition here only makes it resolvable and visible in the tooltip; the behavior still has to be implemented in the fitView/resetView switches and accepted by useZoom for zoom/pan. Document that requirement so future entries are not advertised without functioning.
The reason will be displayed to describe this comment to others. Learn more.
🤖 AI-generated review. This review was produced by an AI assistant (GitHub Copilot) at the request of the maintainer posting it. Please treat it as input to discuss, not as a final decision.
Thanks for this. Putting all the mouse shortcuts in one table (utils/shortcuts.ts / resolveMouseShortcut) is a nice improvement: the d3 zoom filter, both double-click handlers and the tooltip text now come from the same place. The behavior matches what was there before, and the wheel-zoom "grabbing" cursor flicker is fixed along the way.
Validation (PR head 80761ab): tsc --noEmit ✅, vitest run ✅ (14 files, 155 tests), oxlint on the changed files ⚠️ 4 new react-perf warnings compared to main (details in the inline comments).
Main points
The shortcuts tooltip is missing from the editor. It's only mounted in CanvasPanel. The editor canvas uses the same gestures, plus box-select and Delete/Backspace, so users first discover them there. Could the component be reused in the editor's toolbar row?
Could this be a panel header action instead of an overlay? Right now the button is drawn on top of the content of every canvas panel, which adds a wrapper Box, magic numbers for the legend offset, and covers whatever node sits in the top-right corner. Other plugins already put this kind of button in the panel header via the plugin's actions (BarChart.ts, TracingGanttChart.ts): actions: [{ component: CanvasShortcutsAction, location: 'header' }].
The edge-thickness tooltip should explain what issue item 3 asks for: the width follows the latest value of the edge's query, and the edge must use thickness mode Threshold (see inline).
Tests:resolveMouseShortcut is well covered. There are no tests yet for CanvasShortcutsTooltip (accessible name, rows shown on hover/focus, ⌘ vs Ctrl), the legend truncation and its <title>, or the useZoomisPanning change.
Out of scope (maybe a follow-up issue)
strokeWidthFromThresholds keeps the last step in array order that matches, but edgeThresholdWidths is stored in the order the user edits it, not sorted by value. Setting a higher step's width before a lower one can therefore pick the wrong width.
The reason will be displayed to describe this comment to others. Learn more.
BTN_HEIGHT = 32 doesn't match the button that's actually rendered: a size="small"IconButton with padding: '2px' and a fontSize="small" icon is about 24px tall. If the overlay stays, compute the offset from the same constants used to style the button. If the button moves to a panel header action (see the summary), this constant and the shifted legendY aren't needed anymore.
The reason will be displayed to describe this comment to others. Learn more.
Nit: useMemo(() => …, []) for a static object, while PANEL_WRAPPER_SX just above is a module constant. Make this a module-level constant too, for consistency.
The reason will be displayed to describe this comment to others. Learn more.
This overlay shows on every canvas panel in view mode and can cover nodes placed in the top-right corner. A static tooltip doesn't need ZoomContext, so it could be registered as a header action in Canvas.tsx (actions: [{ component, location: 'header' }], like barchart/src/BarChart.ts). The same component could then be reused in the editor (EditorItemsPanel).
The reason will be displayed to describe this comment to others. Learn more.
A fixed 6.5px per character is fragile here: the <text> doesn't set fontFamily, so it inherits the theme font, and the limit works out to 11 characters including the ≥ prefix. Labels that end in a unit (e.g. ≥ 1.23 MB/s) lose the unit first. Options:
measure once with getComputedTextLength() (or size the box to the longest label, with a max width)
or at least set fontFamily explicitly so the estimate holds.
truncateLabel could also run inside the existing rowsuseMemo.
description="Defines stroke widths used when edges have thickness mode set to threshold. The default width applies when no threshold step matches the query value."
The reason will be displayed to describe this comment to others. Learn more.
Suggestion for the text, closer to what issue item 3 asks to explain and to what PanelEdgeLayer.resolveEdgeStyle does:
Suggested change
description="Defines stroke widths used when edges have thickness mode set to threshold. The default width applies when no threshold step matches the query value."
description="When an edge has a query and its thickness mode is set to Threshold, its width follows the latest value of that query: the width of the highest matching threshold step is used. The default width applies otherwise (fixed mode without a custom width, no data, or no matching step)."
The reason will be displayed to describe this comment to others. Learn more.
Nit: narrow the type to 'wheel' | 'mousedown' | 'dblclick', and make SHORTCUTS readonly (as const satisfies readonly MouseShortcut[]). A short comment would also help: adding an entry shows it in the tooltip, but it only works if useZoom accepts it (zoom/pan) or the double-click switch statements handle it.
The reason will be displayed to describe this comment to others. Learn more.
Nice: wheel zoom no longer sets isPanning. Small typing nit: sourceEvent is null for programmatic zoomBehavior.transform calls (fitView/resetPan), so the type should be Event | null. The instanceof check already handles it at runtime.
The reason will be displayed to describe this comment to others. Learn more.
The editor uses the same shortcuts (plus box-select and Delete/Backspace), but no CanvasShortcutsTooltip is rendered for it. Consider adding it to EditorItemsPanel's toolbar row so editors can find these interactions too.
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
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.
Description
Addresses the improvements described in perses/perses#4486.
Adds a tooltip inside the canvas to make navigation easier for users. The issue where the preview doesn't show the
whole display is not solved in code, but the new tooltip shows a shortcut to "fit everything in view," which should
help mitigate it.
Screenshots
New tooltip for canvas shortcuts (legend with long values also visible):
New tooltip for edge thicknes section:
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes