From 2a527ef8622415425b01b4f9364ae48acf83a5ea Mon Sep 17 00:00:00 2001 From: sairamg Date: Tue, 18 Nov 2025 12:57:44 +0530 Subject: [PATCH] update dynamically when text content changes --- src/main-api/Inspector.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main-api/Inspector.ts b/src/main-api/Inspector.ts index 10d0bdf7..1c6e3599 100644 --- a/src/main-api/Inspector.ts +++ b/src/main-api/Inspector.ts @@ -52,14 +52,16 @@ const stylePropertyMap: { }, width: (w) => { if (w === 0) { - return null; + // Set to 1px instead of 0px so visibility checks (e.g. Playwright) keep treating the node as visible + return { prop: 'width', value: '1px' }; } return { prop: 'width', value: `${w}px` }; }, height: (h) => { if (h === 0) { - return null; + // Set to 1px instead of 0px so visibility checks (e.g. Playwright) keep treating the node as visible + return { prop: 'height', value: '1px' }; } return { prop: 'height', value: `${h}px` }; @@ -179,6 +181,7 @@ const knownProperties = new Set([ 'src', 'parent', 'data', + 'text', 'texture', ]); @@ -575,9 +578,10 @@ export class Inspector { if (property === 'text') { div.innerHTML = String(value); - // hide text because we can't render SDF fonts - // it would look weird and obstruct the WebGL rendering - div.style.visibility = 'hidden'; + // Keep DOM text invisible without breaking visibility checks by using color:transparent instead of opacity:0 + div.style.color = 'transparent'; + div.style.pointerEvents = 'none'; + div.style.userSelect = 'none'; return; }