Skip to content

Build your personal knowledge base with Trilium Notes

style(autocomplete): dress the suggestion list as one of the menus

Elian Doran94c3679cf674
diff --git a/apps/client/src/widgets/attribute_widgets/attribute_name_suggestion.css b/apps/client/src/widgets/attribute_widgets/attribute_name_suggestion.css
index 074491435d..da66f22e8e 100644
--- a/apps/client/src/widgets/attribute_widgets/attribute_name_suggestion.css
+++ b/apps/client/src/widgets/attribute_widgets/attribute_name_suggestion.css
@@ -28,9 +28,9 @@
}
/*
- * The badge is sized relative to the row it sits in, and the popup's dropdown carries a larger font
- * than the mention panel does — so the same rule leaves the marker noticeably heavier here. Nudged
- * down so that the two lists read alike.
+ * The badge is sized relative to the row it sits in, and the popup's dropdown still carries a
+ * slightly larger font than the mention panel does — so the same rule leaves the marker heavier
+ * here. Nudged down so that the two lists read alike.
*/
.form-autocomplete-dropdown .attr-name-suggestion .ext-badge {
font-size: 0.65em;
diff --git a/apps/client/src/widgets/react/FormAutocomplete.css b/apps/client/src/widgets/react/FormAutocomplete.css
index 1377b2130f..89dfa7ce08 100644
--- a/apps/client/src/widgets/react/FormAutocomplete.css
+++ b/apps/client/src/widgets/react/FormAutocomplete.css
@@ -1,25 +1,39 @@
+/*
+ * The suggestion list, dressed as one of the application's menus — the same metrics the mention list
+ * in a text note is given, since both are a list of choices floating over the thing being edited.
+ * Every variable below is defined by each theme; the two the older themes leave out (the inner
+ * padding and the corner radius) fall back to the values those themes use for their own menus.
+ */
.form-autocomplete-dropdown {
position: fixed;
z-index: 2000;
margin: 0;
- padding: 0;
+ /* The entries sit inside the rounded border rather than against it, so a highlighted one is a
+ rounded chip within the menu instead of a band across it. */
+ padding: var(--menu-padding-size, 6px);
list-style: none;
overflow-y: auto;
- background-color: var(--main-background-color);
- border: 1px solid var(--main-border-color);
- border-radius: 4px;
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
+ font-size: 0.9rem;
+ color: var(--menu-text-color);
+ background-color: var(--menu-background-color);
+ /* Only the themes that blur their menus define a filter; in the rest this resolves to no blur. */
+ backdrop-filter: var(--dropdown-backdrop-filter);
+ border: 1px solid var(--dropdown-border-color);
+ border-radius: var(--dropdown-border-radius, 6px);
+ box-shadow: 0 10px 20px rgba(0, 0, 0, var(--dropdown-shadow-opacity, 0.2));
}
.form-autocomplete-dropdown .form-autocomplete-item {
cursor: pointer;
- padding: 6px 16px;
+ padding: 4px 8px;
margin: 0;
+ border-radius: 6px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
+/* Pointer and keyboard share the one highlight: hovering an entry makes it the active one. */
.form-autocomplete-dropdown .form-autocomplete-item.active {
color: var(--active-item-text-color);
background-color: var(--active-item-background-color);