Anonumous commited on
Commit
03bb879
·
1 Parent(s): d39c9f9

Fix widgets

Browse files
Files changed (2) hide show
  1. app.py +2 -0
  2. src/display/styles.py +87 -1
app.py CHANGED
@@ -231,6 +231,8 @@ def build_demo() -> gr.Blocks:
231
  interactive=False,
232
  column_widths=column_widths,
233
  elem_id="leaderboard-table",
 
 
234
  )
235
 
236
  # Update table when search changes
 
231
  interactive=False,
232
  column_widths=column_widths,
233
  elem_id="leaderboard-table",
234
+ row_count=(len(leaderboard_df), "fixed"),
235
+ col_count=(len(all_cols), "fixed"),
236
  )
237
 
238
  # Update table when search changes
src/display/styles.py CHANGED
@@ -21,6 +21,32 @@ THEME_DETECTION_JS = """
21
  document.documentElement.classList.remove('dark');
22
  }
23
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  })();
25
  </script>
26
  """
@@ -294,9 +320,10 @@ table tbody td {
294
  white-space: nowrap;
295
  }
296
 
297
- /* Remove black outline artifacts on cell click */
298
  table td, table th {
299
  outline: none !important;
 
300
  }
301
 
302
  table td:focus, table th:focus,
@@ -305,6 +332,65 @@ table td:active, table th:active {
305
  box-shadow: none !important;
306
  }
307
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  /* Constrain model name column */
309
  table td:first-child,
310
  table th:first-child {
 
21
  document.documentElement.classList.remove('dark');
22
  }
23
  });
24
+
25
+ // Remove Gradio selection buttons from table
26
+ function removeSelectionHandles() {
27
+ // Remove all selection buttons (row and column selectors)
28
+ const selectionButtons = document.querySelectorAll(
29
+ '.selection-button, .selection-button-row, .selection-button-col, button[class*="selection-button"]'
30
+ );
31
+ selectionButtons.forEach(btn => {
32
+ btn.remove();
33
+ });
34
+ }
35
+
36
+ // Run after DOM is fully loaded
37
+ window.addEventListener('load', function() {
38
+ removeSelectionHandles();
39
+
40
+ // Re-run when table updates (MutationObserver)
41
+ const observer = new MutationObserver(removeSelectionHandles);
42
+ const table = document.querySelector('table');
43
+ if (table) {
44
+ observer.observe(table, {
45
+ childList: true,
46
+ subtree: true
47
+ });
48
+ }
49
+ });
50
  })();
51
  </script>
52
  """
 
320
  white-space: nowrap;
321
  }
322
 
323
+ /* Remove black outline artifacts and selection handles */
324
  table td, table th {
325
  outline: none !important;
326
+ cursor: default !important;
327
  }
328
 
329
  table td:focus, table th:focus,
 
332
  box-shadow: none !important;
333
  }
334
 
335
+ /* Hide all pseudo-elements in body cells (except medals in first column) */
336
+ table tbody tr td:not(:first-child)::before,
337
+ table tbody tr td:not(:first-child)::after {
338
+ display: none !important;
339
+ content: none !important;
340
+ visibility: hidden !important;
341
+ }
342
+
343
+ /* Disable pointer events on pseudo-elements */
344
+ table tbody tr td::before,
345
+ table tbody tr td::after {
346
+ pointer-events: none !important;
347
+ }
348
+
349
+ /* Hide potential Gradio row/column selectors */
350
+ table tbody tr td > div::before,
351
+ table tbody tr td > div::after,
352
+ table tbody tr td > span::before,
353
+ table tbody tr td > span::after {
354
+ display: none !important;
355
+ visibility: hidden !important;
356
+ }
357
+
358
+ /* Disable user-select to prevent row/column selection UI */
359
+ table tbody tr td {
360
+ user-select: none !important;
361
+ -webkit-user-select: none !important;
362
+ -moz-user-select: none !important;
363
+ }
364
+
365
+ /* Target Gradio internal .cell-wrap class */
366
+ .cell-wrap::before,
367
+ .cell-wrap::after {
368
+ display: none !important;
369
+ content: none !important;
370
+ visibility: hidden !important;
371
+ }
372
+
373
+ .cell-wrap * {
374
+ pointer-events: none !important;
375
+ }
376
+
377
+ /* Hide any absolutely positioned children in cells */
378
+ table tbody tr td > *[style*="position: absolute"],
379
+ table tbody tr td > *[style*="position:absolute"] {
380
+ display: none !important;
381
+ }
382
+
383
+ /* Hide Gradio row/column selection buttons */
384
+ .selection-button,
385
+ .selection-button-row,
386
+ .selection-button-col,
387
+ button[class*="selection-button"] {
388
+ display: none !important;
389
+ visibility: hidden !important;
390
+ opacity: 0 !important;
391
+ pointer-events: none !important;
392
+ }
393
+
394
  /* Constrain model name column */
395
  table td:first-child,
396
  table th:first-child {