Skip to content

Build your personal knowledge base with Trilium Notes

client/ui/context menu: fix menu item label spacing issue

Adorian Doran56dad66adc6f
diff --git a/apps/client/src/menus/context_menu.ts b/apps/client/src/menus/context_menu.ts
index 05850f40e4..be9f511bb9 100644
--- a/apps/client/src/menus/context_menu.ts
+++ b/apps/client/src/menus/context_menu.ts
@@ -330,7 +330,10 @@ class ContextMenu {
const $link = $("<span>")
.append($icon)
- .append(" &nbsp; ") // some space between icon and text
+ // An element rather than spaces: a row is a flex line, so text between the icon and the
+ // title merges with a plain title but is trimmed before a title boxed by `menuName()`,
+ // leaving the two kinds of row indented differently.
+ .append($("<span>").addClass("tn-menu-gap"))
.append(item.title);
if ("badges" in item && item.badges) {
diff --git a/apps/client/src/stylesheets/style.css b/apps/client/src/stylesheets/style.css
index 415c2f0648..4ab85522db 100644
--- a/apps/client/src/stylesheets/style.css
+++ b/apps/client/src/stylesheets/style.css
@@ -1702,6 +1702,12 @@ body.mobile .dropdown-submenu > .dropdown-menu {
-webkit-user-select: none;
}
+/* What stands between a menu item's icon and its title. */
+.dropdown-item .tn-menu-gap {
+ flex: none;
+ width: 0.5em;
+}
+
/* A name the user wrote, boxed by `menuName()`: clipped rather than widening the menu. */
.dropdown-item .tn-menu-name {
display: block;