When selecting text in the stacktrace frameHeader, don't toggle the frame

The frameheader is a typical target for copy/paste actions (filenames/paths)
and having stuff jump around right after selecting is annoying
This commit is contained in:
Klaas van Schelven
2025-08-29 09:34:14 +02:00
parent 6a523a6a67
commit d62d016be3

View File

@@ -88,6 +88,17 @@ function expandSection(element) {
}
function toggleFrameVisibility(frameHeader) {
console.log("toggling frame visibility");
const selection = window.getSelection().toString();
if (selection.length > 0) {
// don't toggle if the user is selecting text (which one might do to copy a
// filename or similar); the assumption here is: if there's a selection,
// it was just created using the mouse because non-selecting mouseclick
// deselect all text before the click is triggered. this assumption
// holds on desktop browsers; on mobile we might need to refine this.
return;
}
const frameDetails = frameHeader.parentNode.querySelector(".js-frame-details");
if (frameDetails.getAttribute("data-collapsed") === "true") {
expandSection(frameDetails);