Skip to content

Commit 8d30b46

Browse files
fix: Hide comments from table preview display
- Remove table comment from appearing as bold title above table - Use HTML title attribute for column comments (hover-only, not visible in static view) - Remove unused tooltip CSS Table and column comments are still accessible via describe() method. Fixes #1391 Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent a1ab055 commit 8d30b46

File tree

1 file changed

+2
-31
lines changed

1 file changed

+2
-31
lines changed

src/datajoint/preview.py

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def repr_html(query_expression):
107107
rel = query_expression.proj(*heading.non_blobs)
108108
# Object fields use codecs - not specially handled in simplified model
109109
object_fields = []
110-
info = heading.table_status
111110
tuples = rel.to_arrays(limit=config["display.limit"] + 1)
112111
has_more = len(tuples) > config["display.limit"]
113112
tuples = tuples[0 : config["display.limit"]]
@@ -155,22 +154,6 @@ def get_html_display_value(tup, name, idx):
155154
background: #f3f1ff;
156155
color: #000000;
157156
}
158-
/* Tooltip container */
159-
.djtooltip {
160-
}
161-
/* Tooltip text */
162-
.djtooltip .djtooltiptext {
163-
visibility: hidden;
164-
width: 120px;
165-
background-color: black;
166-
color: #fff;
167-
text-align: center;
168-
padding: 5px 0;
169-
border-radius: 6px;
170-
/* Position the tooltip text - see examples below! */
171-
position: absolute;
172-
z-index: 1;
173-
}
174157
#primary {
175158
font-weight: bold;
176159
color: black;
@@ -180,11 +163,6 @@ def get_html_display_value(tup, name, idx):
180163
color: white;
181164
}
182165

183-
/* Show the tooltip text when you mouse over the tooltip container */
184-
.djtooltip:hover .djtooltiptext {
185-
visibility: visible;
186-
}
187-
188166
/* Dark mode support */
189167
@media (prefers-color-scheme: dark) {
190168
.Table th{
@@ -201,10 +179,6 @@ def get_html_display_value(tup, name, idx):
201179
background: #3d3d3d;
202180
color: #e0e0e0;
203181
}
204-
.djtooltip .djtooltiptext {
205-
background-color: #555555;
206-
color: #ffffff;
207-
}
208182
#primary {
209183
color: #bd93f9;
210184
}
@@ -214,10 +188,7 @@ def get_html_display_value(tup, name, idx):
214188
}
215189
</style>
216190
"""
217-
head_template = """<div class="djtooltip">
218-
<p id="{primary}">{column}</p>
219-
<span class="djtooltiptext">{comment}</span>
220-
</div>"""
191+
head_template = """<span id="{primary}" title="{comment}">{column}</span>"""
221192
return """
222193
{css}
223194
{title}
@@ -230,7 +201,7 @@ def get_html_display_value(tup, name, idx):
230201
{count}</div>
231202
""".format(
232203
css=css,
233-
title="" if info is None else "<b>%s</b>" % info["comment"],
204+
title="", # Table comment not shown in preview; available via describe()
234205
head="</th><th>".join(
235206
head_template.format(
236207
column=c,

0 commit comments

Comments
 (0)