Skip to content

Commit 7e56866

Browse files
committed
fix: use outline border instead of blue overlay for edit mode hover highlight
Replace the distracting blue background overlay (rgba(0,162,255,0.2)) with a subtle 1px outline border matching the click selection style.
1 parent b9108c0 commit 7e56866

1 file changed

Lines changed: 11 additions & 17 deletions

File tree

‎src/LiveDevelopment/BrowserScripts/RemoteFunctions.js‎

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ function RemoteFunctions(config = {}) {
548548
if (this.trigger) {
549549
_trigger(this.elements[i], "highlight", 0);
550550
}
551-
clearElementBackground(this.elements[i]);
551+
clearElementHoverHighlight(this.elements[i]);
552552
}
553553

554554
this.elements = [];
@@ -583,19 +583,12 @@ function RemoteFunctions(config = {}) {
583583
return getHighlightMode() !== "click";
584584
}
585585

586-
// helper function to clear element background highlighting
587-
function clearElementBackground(element) {
588-
if (element._originalBackgroundColor !== undefined) {
589-
element.style.backgroundColor = element._originalBackgroundColor;
590-
} else {
591-
// only clear background if it's currently a highlight color, not if it's an original user style
592-
const currentBg = element.style.backgroundColor;
593-
if (currentBg === "rgba(0, 162, 255, 0.2)" || currentBg.includes("rgba(0, 162, 255")) {
594-
element.style.backgroundColor = "";
595-
}
596-
// if it's some other color, we just leave it as is - it's likely a user-defined style
586+
// helper function to clear element hover outline highlighting
587+
function clearElementHoverHighlight(element) {
588+
if (element._originalHoverOutline !== undefined) {
589+
element.style.outline = element._originalHoverOutline;
597590
}
598-
delete element._originalBackgroundColor;
591+
delete element._originalHoverOutline;
599592
}
600593

601594
function onElementHover(event) {
@@ -622,9 +615,10 @@ function RemoteFunctions(config = {}) {
622615
if (_hoverHighlight && shouldShowHighlightOnHover()) {
623616
_hoverHighlight.clear();
624617

625-
// Store original background color to restore on hover out
626-
element._originalBackgroundColor = element.style.backgroundColor;
627-
element.style.backgroundColor = "rgba(0, 162, 255, 0.2)";
618+
// Store original outline to restore on hover out, then apply a blue border
619+
element._originalHoverOutline = element.style.outline;
620+
const outlineColor = element.hasAttribute(GLOBALS.DATA_BRACKETS_ID_ATTR) ? "#4285F4" : "#3C3F41";
621+
element.style.outline = `1px solid ${outlineColor}`;
628622

629623
_hoverHighlight.add(element, false);
630624

@@ -646,7 +640,7 @@ function RemoteFunctions(config = {}) {
646640
// this is to check the user's settings, if they want to show the elements highlights on hover or click
647641
if (_hoverHighlight && shouldShowHighlightOnHover()) {
648642
_hoverHighlight.clear();
649-
clearElementBackground(element);
643+
clearElementHoverHighlight(element);
650644
// dismiss the info box
651645
const infoBoxHandler = LivePreviewView.getToolHandler("InfoBox");
652646
if (infoBoxHandler) {

0 commit comments

Comments
 (0)