kalamishere Claude Opus 4.7 commited on
Commit
7c1e325
Β·
1 Parent(s): 6262557

Upload zones: hide Gradio internals, render own prompt via ::after

Browse files

Codex strategy switch. Native upload markup has shifted across
v6 builds β€” first giant icon, then '- or -' stray, then blank.
Each selective fix broke a different render path. Stop chasing.

- Hide everything inside the upload <button>: .wrap, .icon-wrap,
.or. Button-scoped so non-upload pages are untouched.
- Render our own centered prompt via button::after with
pointer-events: none so clicks still pass through.
- Per-zone copy:
Upload: 'Click to Upload'
Import: 'Drop or choose .abv1'

Acceptance: each drop zone shows its prompt; clicking opens the
file picker; no stray '- or -'; no giant/clipped icons.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Files changed (1) hide show
  1. theme.py +39 -34
theme.py CHANGED
@@ -1396,18 +1396,6 @@ span.has-info {
1396
  align-items: flex-start !important;
1397
  }
1398
 
1399
- /* Hide Gradio's default "- or -" inside the upload zones. Reads as a
1400
- broken fragment after we've customized the surrounding affordance.
1401
- Button-scoped so we never accidentally hit other `.or` content
1402
- elsewhere; substring fallback for builds where the class name has
1403
- a svelte hash appended. NEVER widen this to `span` / `.wrap` / `svg`
1404
- β€” that crushes the icon and the Click-to-Upload text too. */
1405
- .dc-upload-audio button .or,
1406
- .dc-import-file button .or,
1407
- .dc-upload-audio button span[class*="or"],
1408
- .dc-import-file button span[class*="or"] {
1409
- display: none !important;
1410
- }
1411
  .dc-ingest-card {
1412
  border: 1px solid var(--line) !important;
1413
  border-radius: 12px !important;
@@ -1437,8 +1425,12 @@ span.has-info {
1437
  margin-bottom: 10px;
1438
  }
1439
 
1440
- /* ---- File-upload zones β€” keep Gradio upload shells compact without clipping
1441
- labels or source/action affordances. */
 
 
 
 
1442
  .dc-upload-audio,
1443
  .dc-import-file {
1444
  min-height: 0 !important;
@@ -1446,34 +1438,47 @@ span.has-info {
1446
 
1447
  .dc-upload-audio button,
1448
  .dc-import-file button {
 
1449
  min-height: 0 !important;
 
 
 
1450
  }
1451
 
1452
- /* gr.File(height=120) sets the drop-zone height, but Gradio's
1453
- internal .icon-wrap svg (feather-upload glyph) expands to fill the
1454
- available width β€” verified live at ~1019Γ—205px. Cap the icon-wrap
1455
- container and its child svg explicitly. NO overflow:hidden on
1456
- parents (that's what clipped the labels last time). */
1457
  .dc-upload-audio button .icon-wrap,
1458
- .dc-import-file button .icon-wrap {
1459
- width: 32px !important;
1460
- height: 32px !important;
1461
- flex: 0 0 32px !important;
1462
- display: inline-flex !important;
 
 
 
 
 
1463
  align-items: center !important;
1464
  justify-content: center !important;
 
 
 
 
 
 
 
 
1465
  }
1466
 
1467
- .dc-upload-audio button .icon-wrap svg,
1468
- .dc-import-file button .icon-wrap svg,
1469
- .dc-upload-audio button > svg,
1470
- .dc-import-file button > svg {
1471
- display: block !important;
1472
- width: 28px !important;
1473
- height: 28px !important;
1474
- max-width: 28px !important;
1475
- max-height: 28px !important;
1476
- flex: 0 0 28px !important;
1477
  }
1478
 
1479
  /* ---- Tab strip β€” flat, centered, cap-styled section index. Reads as
 
1396
  align-items: flex-start !important;
1397
  }
1398
 
 
 
 
 
 
 
 
 
 
 
 
 
1399
  .dc-ingest-card {
1400
  border: 1px solid var(--line) !important;
1401
  border-radius: 12px !important;
 
1425
  margin-bottom: 10px;
1426
  }
1427
 
1428
+ /* ---- File-upload zones β€” Codex move: stop chasing Gradio's native
1429
+ upload markup (icon class names + text strings keep shifting
1430
+ between v6 builds, leading to giant icons β†’ blank zones).
1431
+ Instead: hide everything inside the upload <button>, then
1432
+ render our own prompt via ::after. The button stays clickable
1433
+ (pseudo-element gets pointer-events: none). */
1434
  .dc-upload-audio,
1435
  .dc-import-file {
1436
  min-height: 0 !important;
 
1438
 
1439
  .dc-upload-audio button,
1440
  .dc-import-file button {
1441
+ position: relative !important;
1442
  min-height: 0 !important;
1443
+ display: flex !important;
1444
+ align-items: center !important;
1445
+ justify-content: center !important;
1446
  }
1447
 
1448
+ /* Native upload internals β€” icon, "Drop File Here", "- or -",
1449
+ "Click to Upload". All unreliable across Gradio v6 builds, so hide
1450
+ them inside the button only. */
1451
+ .dc-upload-audio button .wrap,
1452
+ .dc-import-file button .wrap,
1453
  .dc-upload-audio button .icon-wrap,
1454
+ .dc-import-file button .icon-wrap,
1455
+ .dc-upload-audio button .or,
1456
+ .dc-import-file button .or {
1457
+ display: none !important;
1458
+ }
1459
+
1460
+ /* Our deliberate, stable prompt. */
1461
+ .dc-upload-audio button::after,
1462
+ .dc-import-file button::after {
1463
+ display: flex !important;
1464
  align-items: center !important;
1465
  justify-content: center !important;
1466
+ width: 100%;
1467
+ height: 100%;
1468
+ color: var(--ink3);
1469
+ font-family: 'Space Grotesk', sans-serif;
1470
+ font-size: 18px;
1471
+ font-weight: 500;
1472
+ text-align: center;
1473
+ pointer-events: none;
1474
  }
1475
 
1476
+ .dc-upload-audio button::after {
1477
+ content: "Click to Upload";
1478
+ }
1479
+
1480
+ .dc-import-file button::after {
1481
+ content: "Drop or choose .abv1";
 
 
 
 
1482
  }
1483
 
1484
  /* ---- Tab strip β€” flat, centered, cap-styled section index. Reads as