Skip to content

Build your personal knowledge base with Trilium Notes

fix(llm_chat): scope the chat highlight rule to message content (closes #12021)

Elian Dorandb97fe63049e
diff --git a/apps/client/src/widgets/type_widgets/llm_chat/chat_highlights.css b/apps/client/src/widgets/type_widgets/llm_chat/chat_highlights.css
index 8699513cfd..1f184fb145 100644
--- a/apps/client/src/widgets/type_widgets/llm_chat/chat_highlights.css
+++ b/apps/client/src/widgets/type_widgets/llm_chat/chat_highlights.css
@@ -1,6 +1,9 @@
/* Painted over user-created highlight ranges via the CSS Custom Highlight API (see chat_highlights.ts).
- The name matches the single registry entry ("chat-highlight"), so only chat highlight ranges use it. */
-::highlight(chat-highlight) {
+ The name matches the single registry entry ("chat-highlight"), so only chat highlight ranges use it.
+ Scoped to the message content, where every range lives: a document-wide ::highlight() rule
+ crashes Chrome's renderer on some text notes (#12021). */
+.llm-chat-message-content::highlight(chat-highlight),
+.llm-chat-message-content *::highlight(chat-highlight) {
background-color: var(--chat-highlight-background-color, #ffe066);
color: var(--chat-highlight-text-color, #1a1a1a);
}