Repository navigation
Hide the quick actions toolbar for right-click selections - #138
Conversation
Lorena-J
left a comment
There was a problem hiding this comment.
The fix resolves the toolbar overlap after a right-click. I found two regressions in Chrome: Ask the assistant… no longer opens the instruction field from the context menu, and clearing the selection and then reselecting the same word leaves the toolbar hidden. Both cases work on the base branch. Could we scope the suppression to the selection associated with that right-click, allow explicit actions to show the toolbar, and add regression tests for both cases?
| const visible = !dragging && (view.hasFocus || within || !!job || !!pending) | ||
| const visible = | ||
| !dragging && | ||
| !(!pending && !job && hideSelection === `${sel.from}-${sel.to}`) && |
There was a problem hiding this comment.
With a word selected, right-click it and choose Ask the assistant…. The menu closes, but the instruction field never opens because the visibility check still hides the toolbar for that selection. Could we let an explicit request to open the instruction field override the right-click suppression?
There was a problem hiding this comment.
Fixed: an explicit request to open the instruction field now overrides the right-click suppression, so Ask the assistant… opens it. Covered by the new test 'Ask the assistant… from the context menu opens the instruction field for a right-click selection'.
| // WebKit selects the word under a right-click, maybe just after this event. | ||
| const mark = () => { | ||
| const m = view.current?.state.selection.main | ||
| setMenuSel(m && !m.empty ? `${m.from}-${m.to}` : '') |
There was a problem hiding this comment.
Double-click a word, right-click it, dismiss the context menu, then clear the selection and double-click the same word again. The toolbar stays hidden because the new selection has the same offsets as the one saved here. Could we clear the suppression when the selection changes so it applies only to that right-click selection?
There was a problem hiding this comment.
Fixed: the suppression is cleared as soon as the selection changes, so it only applies to the selection that right-click made. Reselecting the same word shows the toolbar again. Covered by the new test 'selecting the right-clicked word again shows the quick actions toolbar' (it fails without the fix in Chrome; the spec passes in Chrome and WebKit).
…sk the assistant open it
Closes #102
WebKit selects the word under a right-click, and the quick actions toolbar then appeared for that selection, covering the next line near the top of a document. A selection made by a right-click (context menu) no longer shows the toolbar; extending it with the keyboard or mouse shows it again. Drag, double-click and keyboard selections are unchanged.
The workaround in web/e2e/wordcounter.spec.ts (
collapseRightClickSelection) is removed, and a spec covers the new behaviour.Tests:
tsc --noEmitclean, fmt/lint (existing warnings only),make e2e BROWSER=allpasses in Chrome and WebKit.