From b7da3792b8abd47bf262f9fdc3bb89f6b424ac77 Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Fri, 29 Nov 2024 19:21:58 +0300 Subject: [WebUI] Rework symbol description display on hover - Replaced 'abbr title' with dynamic description display on hover or focus - Added tabindex for keyboard accessibility - Improved symbol rendering using template literals for readability --- interface/css/rspamd.css | 13 +++++++++++++ interface/js/app/libft.js | 16 +++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/interface/css/rspamd.css b/interface/css/rspamd.css index e7c1e91b8..896f92008 100644 --- a/interface/css/rspamd.css +++ b/interface/css/rspamd.css @@ -265,6 +265,19 @@ table#symbolsTable input[type="number"] { background-color: #cddbff; } +/* For symbol description display on hover/focus */ +.symbol-default.has-description:not(:focus) strong { + text-decoration: underline dotted; +} +.symbol-description { + display: none; + color: #484848; +} +.symbol-default:hover .symbol-description, +.symbol-default:focus .symbol-description { + display: unset; +} + .map-link { display: block; color: #0088cc; diff --git a/interface/js/app/libft.js b/interface/js/app/libft.js index 84ee2667e..7106516a2 100644 --- a/interface/js/app/libft.js +++ b/interface/js/app/libft.js @@ -573,17 +573,15 @@ define(["jquery", "app/common", "footable"], ui.preprocess_item(item); Object.values(item.symbols).forEach((sym) => { - sym.str = ''; - - if (sym.description) { - sym.str += '' + sym.name + ""; - } else { - sym.str += sym.name; - } - sym.str += " (" + sym.score + ")"; + sym.str = ` + + ${sym.name} + ${sym.description ? ` • ${sym.description}` : ""} + (${sym.score}) +`; if (sym.options) { - sym.str += " [" + sym.options.join(",") + "]"; + sym.str += ` [${sym.options.join(",")}]`; } }); unsorted_symbols.push(item.symbols); -- cgit v1.2.3