feat: added hover and long press tooltips to quicktools#2456
Conversation
Greptile SummaryThis PR adds hover and long-press tooltip support to the editor quick-tools toolbar, introducing a reusable singleton
Confidence Score: 5/5Safe to merge — the tooltip feature is additive, touch interaction logic is preserved, and all previously flagged regressions have been corrected. The core logic changes are straightforward: a new singleton tooltip element, RAF-guarded positioning, and a
Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant User
participant RowItem
participant quickToolsInit
participant Tooltip
Note over User,Tooltip: Mouse hover flow
User->>RowItem: mouseenter
RowItem->>Tooltip: showTooltip($item, description(id))
Tooltip->>Tooltip: cancelAnimationFrame(rafId)
Tooltip->>Tooltip: RAF → position + animate(opacity:1)
User->>RowItem: mouseleave
RowItem->>Tooltip: hideTooltip()
Tooltip->>Tooltip: animate(opacity:0)
Note over User,Tooltip: Touch long-press flow
User->>quickToolsInit: touchstart
quickToolsInit->>quickToolsInit: setTimeout(500ms)
quickToolsInit->>Tooltip: showTooltip($el, description($el.dataset.id))
alt repeat button
quickToolsInit->>quickToolsInit: "contextmenu=true, oncontextmenu()"
end
User->>quickToolsInit: touchend / touchcancel
quickToolsInit->>Tooltip: hideTooltip()
Note over User,Tooltip: Click (any mode)
User->>quickToolsInit: click / onclick
quickToolsInit->>Tooltip: hideTooltip()
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant User
participant RowItem
participant quickToolsInit
participant Tooltip
Note over User,Tooltip: Mouse hover flow
User->>RowItem: mouseenter
RowItem->>Tooltip: showTooltip($item, description(id))
Tooltip->>Tooltip: cancelAnimationFrame(rafId)
Tooltip->>Tooltip: RAF → position + animate(opacity:1)
User->>RowItem: mouseleave
RowItem->>Tooltip: hideTooltip()
Tooltip->>Tooltip: animate(opacity:0)
Note over User,Tooltip: Touch long-press flow
User->>quickToolsInit: touchstart
quickToolsInit->>quickToolsInit: setTimeout(500ms)
quickToolsInit->>Tooltip: showTooltip($el, description($el.dataset.id))
alt repeat button
quickToolsInit->>quickToolsInit: "contextmenu=true, oncontextmenu()"
end
User->>quickToolsInit: touchend / touchcancel
quickToolsInit->>Tooltip: hideTooltip()
Note over User,Tooltip: Click (any mode)
User->>quickToolsInit: click / onclick
quickToolsInit->>Tooltip: hideTooltip()
Reviews (4): Last reviewed commit: "fix: replaced title attribute" | Re-trigger Greptile |
This comment was marked as outdated.
This comment was marked as outdated.
|
|
||
| padding: 6px 10px; | ||
|
|
||
| background: rgba(40,40,40,.95); |
There was a problem hiding this comment.
It should use theme var to match app theme
|
|
||
| transform: translateY(5px); | ||
|
|
||
| transition: .15s; |
There was a problem hiding this comment.
it will be better to use motion(WAAPI) library for animation
| if ($el.dataset.repeat === "true") { | ||
| contextmenuTimeout = setTimeout(() => { | ||
| if (touchMoved) return; | ||
| contextmenuTimeout = setTimeout(() => { |
There was a problem hiding this comment.
Long-press tooltips still execute non-repeat actions on release. The timeout shows the tooltip for every button, but contextmenu is only set for data-repeat="true" buttons. For non-repeat buttons, touchend reaches click($el), so a user long-pressing to inspect a tooltip can still insert text, save, open search settings, replace, etc.
Summary of this PR
This PR adds tooltips for the editor quick tools.
Changes
Testing
Closes #2268