Description
If you create a chart (e.g. Table Chart) with a custom SQL query that has an <a>
, the resulting chart can be created and nested in a dashboard and you won’t be able to use the Drill by feature with it because nothing appears.
How to reproduce the bug
- Create a Table chart
- Use as dimension a column that has a
<a>
tag applied in the Custom SQL section. It could be something like this'<a href="https://www.google.com/search?q=' || Product_Category || '">' || Product_Category || '</a>'
- Save the chart in a dashboard and then use the Drill by feature in that column
Expected results
The prompted window after using Drill by shows you the details of the category
Actual results
The prompted window after using Drill by doesn’t show anything
Known Workarounds
No workarounds are currently known
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.9
Node version
16
Browser
Chrome
Additional context
No response
Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Comment From: dosubot[bot]
This is a known limitation in how Drill by works with columns containing HTML, such as tags. The root cause is that when you use Drill by on a table cell, Superset passes the raw SQL value (which includes the HTML markup) as the filter value, rather than the plain text label that’s displayed to users. Since the filter value includes the HTML, it doesn’t match the expected values in the dataset, so no results are shown. The table chart does sanitize and render HTML for display, but the Drill by logic doesn’t strip HTML before filtering, which causes this disconnect reference.
There isn’t a built-in workaround right now. To address this, the code that handles Drill by/context menu events should strip HTML tags from the filter value before applying the filter. The codebase already includes utilities for HTML sanitization and tag removal, so this would be a straightforward fix for a developer familiar with the frontend code reference.
No existing tickets or documentation specifically address this scenario, but the technical root cause is clear from the code. If you need to use Drill by on these columns, you’ll need to avoid embedding HTML in the dimension values, or consider a code change to strip HTML before filtering.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other