Repository navigation
fix(response-viewer): a middle click on a file path opens it instead of the dashboard root - #731
Conversation
…of the dashboard root Path links and in-document links carry a placeholder href (#, #fragment) that the click delegate resolves itself, but a middle click fires auxclick, never click, so the browser followed the placeholder and opened the dashboard root in a new tab. A middle click on those links now does what a click does; real URLs keep the browser's own middle click.
|
Thanks @JDProfresh, this is a clean fix. A middle click on a file path or an in-document link in the Response Viewer (and in the File Viewer's rendered markdown) no longer opens the dashboard root in a new tab: it now does what a left click does, while real URLs keep the browser's own middle click. I reproduced the bug on master in headless Chromium (new tabs at Nothing to change on your side. This is ready to merge. |
|
Merged in 1.47.0 (https://github.com/Ark0N/Codeman/releases/tag/codeman%401.47.0). Thank you, nothing needed changing. #716 (issue, hedburgaren): closed by #726 via "Fixes #716". If it stays open, comment:Fixed in 1.47.0 (https://github.com/Ark0N/Codeman/releases/tag/codeman%401.47.0) by #726 from @Hugo-DDT: a dead-key backtick on a desktop keyboard arrives once, and plain-text Ctrl+V is framed as a bracketed paste by Codeman itself, so a copied newline no longer submits after a replay. Thanks for the clear report. |
A middle click fires
auxclick, neverclick, so the Response Viewer's click delegate never saw it and the browser followed the link's placeholderhref="#", which with<base href="/">is the dashboard root.Problem
In the Response Viewer, and in the File Viewer's rendered markdown (which binds the same delegate), a middle click on a file path opened a new tab with the dashboard in it instead of the file. The same happened with in-document links such as
[Install](#install): a new tab of the dashboard at/#install. A left click and Ctrl/Cmd+click on the same links already open the preview, the folder grid or scroll in place.Cause
File-path links (
a.rv-path) carryhref="#"and in-document linkshref="#fragment": placeholders that_bindResponseViewerInteractionsresolves itself onclick. Nothing listened forauxclick, so a middle click fell through to the browser's default for the placeholder.What it does
The two placeholder branches of the click delegate move into one local function, called from the existing
clicklistener and from a newauxclicklistener that acts on the middle button only. A middle click on a path or folder link now opens the preview or the folder grid for the same resolved path and session a click would, and a middle click on an in-document link scrolls there. Right, back and forward buttons are ignored. Real URLs (anything with a scheme, loopback ones included) keep the browser's own middle click, as before; this keeps your ask on #545 to leave middle clicks on real links to the browser, since a path link's href is a placeholder the browser cannot open. The bind stays idempotent, and the left-click path is unchanged.Tests
test/response-viewer-middle-click.test.tsdrives the shippingconstants.js,app.jsandterminal-ui.jsin a jsdom window and dispatches realauxclickandclickevents:openFilePreview('/home/me/proj/src/app.ts', 'sess-1'), default prevented; the same for a markdown link whose destination is a path, and with Ctrl heldopenFolderGridwith the path and session#install:scrollIntoViewon the heading, default preventedhttps://andhttp://localhost:5173/links: default not prevented, nothing called (the loopback web-tab hook included)clickopenFilePreview('/home/me/proj/src/app.ts', 'sess-1')andhttp://localhost:5173/still goes to the loopback web-tab hook, both with the default preventedSeven of the fifteen cases fail on master (default not prevented, nothing opened); the suite also goes red when the button check, the shared click path, the loopback branch, the idempotency flag or the real-URL exclusion is removed.
Verified
I checked it in headless Chromium (Playwright) on a page with
<base href="/">loading the shippingconstants.jsandapp.js, before and after:/##install/#installhttps://example.com/Right click and left click behaved the same before and after. I have not run it against a full Codeman instance, or in Firefox or Safari.