Spaces:
Sleeping
Sleeping
Fix chatbot bubble CSS: use correct Gradio 6 DOM selectors
Browse filesIn Gradio 6, .chatbot is on the inner prose element inside message
bubbles, NOT on the outer container. The old selectors like
.chatbot .bot required .bot to be a DESCENDANT of .chatbot, but
the actual DOM has .bot as an ANCESTOR - so no rule ever matched.
Replace with :root .message-wrap .bot / .user which correctly targets
the bubble divs, plus :root .bubble-wrap for the scroll container.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -225,28 +225,25 @@ button:not(.primary) {
|
|
| 225 |
ul[role="listbox"] li,
|
| 226 |
.option { color: var(--pc-text) !important; }
|
| 227 |
|
| 228 |
-
/* === Chatbot (Gradio 6) ===
|
| 229 |
-
|
| 230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
background: var(--pc-surface) !important;
|
| 232 |
-
border-color: var(--pc-border) !important;
|
| 233 |
}
|
| 234 |
-
.
|
| 235 |
-
|
| 236 |
-
|
| 237 |
}
|
| 238 |
-
.
|
| 239 |
-
|
| 240 |
-
|
| 241 |
}
|
| 242 |
-
|
| 243 |
-
.
|
| 244 |
-
.chatbot .user *,
|
| 245 |
-
.chatbot [data-testid="bot"] *,
|
| 246 |
-
.chatbot [data-testid="user"] *,
|
| 247 |
-
.chatbot .prose,
|
| 248 |
-
.chatbot .prose p,
|
| 249 |
-
.chatbot p { color: var(--pc-text) !important; }
|
| 250 |
|
| 251 |
/* === Plotly charts — override SVG text in light mode === */
|
| 252 |
@media (prefers-color-scheme: light) {
|
|
|
|
| 225 |
ul[role="listbox"] li,
|
| 226 |
.option { color: var(--pc-text) !important; }
|
| 227 |
|
| 228 |
+
/* === Chatbot (Gradio 6) — correct DOM structure ===
|
| 229 |
+
In Gradio 6 the .chatbot class is on the INNER prose element inside each
|
| 230 |
+
message bubble, NOT on the outer container. That means ".chatbot .bot"
|
| 231 |
+
is backwards — .bot is an ANCESTOR of .chatbot, not a descendant.
|
| 232 |
+
Correct scoping: .message-wrap contains the .bot / .user bubble divs.
|
| 233 |
+
.bubble-wrap is the outer scrollable pane. */
|
| 234 |
+
:root .bubble-wrap {
|
| 235 |
background: var(--pc-surface) !important;
|
|
|
|
| 236 |
}
|
| 237 |
+
:root .message-wrap .bot {
|
| 238 |
+
background-color: var(--pc-surface-alt) !important;
|
| 239 |
+
border-color: var(--pc-border) !important;
|
| 240 |
}
|
| 241 |
+
:root .message-wrap .user {
|
| 242 |
+
background-color: rgba(74,222,128,0.13) !important;
|
| 243 |
+
border-color: rgba(74,222,128,0.4) !important;
|
| 244 |
}
|
| 245 |
+
:root .message-wrap .bot *,
|
| 246 |
+
:root .message-wrap .user * { color: var(--pc-text) !important; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
|
| 248 |
/* === Plotly charts — override SVG text in light mode === */
|
| 249 |
@media (prefers-color-scheme: light) {
|