Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.

Commit dc9073b

Browse files
committed
feat: Add debug info to TableWidget footer to diagnose theme issues
1 parent 89b84b3 commit dc9073b

1 file changed

Lines changed: 33 additions & 35 deletions

File tree

bigframes/display/table_widget.js

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ function render({ model, el }) {
4848
const footer = document.createElement("footer");
4949
footer.classList.add("footer");
5050

51+
// Debug info container
52+
const debugInfo = document.createElement("div");
53+
debugInfo.classList.add("debug-info");
54+
debugInfo.style.fontSize = "10px";
55+
debugInfo.style.color = "gray";
56+
debugInfo.style.marginTop = "8px";
57+
debugInfo.style.borderTop = "1px solid #ccc";
58+
debugInfo.style.paddingTop = "4px";
59+
5160
// Pagination controls
5261
const paginationContainer = document.createElement("div");
5362
paginationContainer.classList.add("pagination");
@@ -133,6 +142,28 @@ function render({ model, el }) {
133142
model.save_changes();
134143
}
135144

145+
function updateDebugInfo() {
146+
const computedStyle = getComputedStyle(el);
147+
const prefersDark = window.matchMedia(
148+
"(prefers-color-scheme: dark)",
149+
).matches;
150+
const vscodeFg = computedStyle.getPropertyValue(
151+
"--vscode-editor-foreground",
152+
);
153+
const vscodeBg = computedStyle.getPropertyValue(
154+
"--vscode-editor-background",
155+
);
156+
157+
debugInfo.innerHTML = `
158+
<strong>Debug Info:</strong><br>
159+
Prefers Dark Scheme: ${prefersDark}<br>
160+
VSCode Foreground: ${vscodeFg || "Not Set"}<br>
161+
VSCode Background: ${vscodeBg || "Not Set"}<br>
162+
Computed Color: ${computedStyle.color}<br>
163+
Computed Bg: ${computedStyle.backgroundColor}
164+
`;
165+
}
166+
136167
/** Updates the HTML in the table container and refreshes button states. */
137168
function handleTableHTMLChange() {
138169
// Note: Using innerHTML is safe here because the content is generated
@@ -209,42 +240,8 @@ function render({ model, el }) {
209240
}
210241
});
211242

212-
const table = tableContainer.querySelector("table");
213-
if (table) {
214-
const tableBody = table.querySelector("tbody");
215-
216-
/**
217-
* Handles row hover events.
218-
* @param {!Event} event - The mouse event.
219-
* @param {boolean} isHovering - True to add hover class, false to remove.
220-
*/
221-
function handleRowHover(event, isHovering) {
222-
const cell = event.target.closest("td");
223-
if (cell) {
224-
const row = cell.closest("tr");
225-
const origRowId = row.dataset.origRow;
226-
if (origRowId) {
227-
const allCellsInGroup = tableBody.querySelectorAll(
228-
`tr[data-orig-row="${origRowId}"] td`,
229-
);
230-
allCellsInGroup.forEach((c) => {
231-
c.classList.toggle("row-hover", isHovering);
232-
});
233-
}
234-
}
235-
}
236-
237-
if (tableBody) {
238-
tableBody.addEventListener("mouseover", (event) =>
239-
handleRowHover(event, true),
240-
);
241-
tableBody.addEventListener("mouseout", (event) =>
242-
handleRowHover(event, false),
243-
);
244-
}
245-
}
246-
247243
updateButtonStates();
244+
updateDebugInfo();
248245
}
249246

250247
// Add error message handler
@@ -288,6 +285,7 @@ function render({ model, el }) {
288285
footer.appendChild(rowCountLabel);
289286
footer.appendChild(paginationContainer);
290287
footer.appendChild(pageSizeContainer);
288+
footer.appendChild(debugInfo);
291289

292290
el.appendChild(errorContainer);
293291
el.appendChild(tableContainer);

0 commit comments

Comments
 (0)