Roman190928 commited on
Commit
41c1ef8
·
verified ·
1 Parent(s): 09a0929

Fix setting help hover tooltip to show descriptions instead of question mark

Browse files
Files changed (1) hide show
  1. app.py +35 -1
app.py CHANGED
@@ -270,6 +270,7 @@ APP_CSS = """
270
  }
271
 
272
  .setting-help-q {
 
273
  display: inline-flex;
274
  align-items: center;
275
  justify-content: center;
@@ -286,6 +287,37 @@ APP_CSS = """
286
  line-height: 1;
287
  vertical-align: middle;
288
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  """
290
 
291
  THEME_JS = """
@@ -377,7 +409,9 @@ SETTING_HELP_JS = """
377
  const q = document.createElement("span");
378
  q.className = "setting-help-q";
379
  q.textContent = "?";
380
- q.title = match[1];
 
 
381
  label.appendChild(q);
382
  }
383
  return [];
 
270
  }
271
 
272
  .setting-help-q {
273
+ position: relative;
274
  display: inline-flex;
275
  align-items: center;
276
  justify-content: center;
 
287
  line-height: 1;
288
  vertical-align: middle;
289
  }
290
+
291
+ .setting-help-q::after {
292
+ content: attr(data-help);
293
+ position: absolute;
294
+ left: 50%;
295
+ bottom: calc(100% + 0.4rem);
296
+ transform: translateX(-50%);
297
+ min-width: 180px;
298
+ max-width: 320px;
299
+ padding: 0.42rem 0.55rem;
300
+ border: 1px solid var(--border);
301
+ border-radius: 0.5rem;
302
+ background: color-mix(in srgb, var(--bg-surface) 98%, transparent);
303
+ color: var(--text-main);
304
+ font-size: 0.74rem;
305
+ font-weight: 500;
306
+ line-height: 1.25;
307
+ box-shadow: var(--shadow);
308
+ opacity: 0;
309
+ pointer-events: none;
310
+ visibility: hidden;
311
+ transition: opacity 120ms ease;
312
+ z-index: 50;
313
+ white-space: normal;
314
+ }
315
+
316
+ .setting-help-q:hover::after,
317
+ .setting-help-q:focus-visible::after {
318
+ opacity: 1;
319
+ visibility: visible;
320
+ }
321
  """
322
 
323
  THEME_JS = """
 
409
  const q = document.createElement("span");
410
  q.className = "setting-help-q";
411
  q.textContent = "?";
412
+ q.setAttribute("data-help", match[1]);
413
+ q.setAttribute("aria-label", match[1]);
414
+ q.tabIndex = 0;
415
  label.appendChild(q);
416
  }
417
  return [];