Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/main-api/Inspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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` };
Expand Down Expand Up @@ -179,6 +181,7 @@ const knownProperties = new Set<string>([
'src',
'parent',
'data',
'text',
'texture',
]);

Expand Down Expand Up @@ -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;
}

Expand Down