You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2026/04/08 19:26:02 UTC

(superset) branch master updated: fix(plugin-chart-handlebars): improve CSS sanitization tooltip and hide when not needed (#39180)

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 36de05fe366 fix(plugin-chart-handlebars): improve CSS sanitization tooltip and hide when not needed (#39180)
36de05fe366 is described below

commit 36de05fe366ff73f2caf65988a4e82206faa9f41
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Wed Apr 8 12:25:54 2026 -0700

    fix(plugin-chart-handlebars): improve CSS sanitization tooltip and hide when not needed (#39180)
    
    Co-authored-by: Claude Opus 4.6 <no...@anthropic.com>
---
 .../src/plugin/controls/style.tsx                     | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controls/style.tsx b/superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controls/style.tsx
index ce4b6cf48bf..b38635faa6d 100644
--- a/superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controls/style.tsx
+++ b/superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controls/style.tsx
@@ -30,10 +30,12 @@ import { debounceFunc } from '../../consts';
 
 interface StyleCustomControlProps {
   value: string;
+  htmlSanitization: boolean;
 }
 
 const StyleControl = (props: CustomControlConfig<StyleCustomControlProps>) => {
   const theme = useTheme();
+  const htmlSanitization = props.htmlSanitization ?? true;
 
   const defaultValue = props?.value
     ? undefined
@@ -48,10 +50,16 @@ const StyleControl = (props: CustomControlConfig<StyleCustomControlProps>) => {
       <ControlHeader>
         <div>
           {props.label}
-          <InfoTooltip
-            iconStyle={{ marginLeft: theme.sizeUnit }}
-            tooltip={t('You need to configure HTML sanitization to use CSS')}
-          />
+          {htmlSanitization && (
+            <InfoTooltip
+              iconStyle={{ marginLeft: theme.sizeUnit }}
+              tooltip={t(
+                'CSS styles may be removed by server-side HTML sanitization. ' +
+                  'If styles are not applying, ask your Superset administrator ' +
+                  'to adjust the HTML sanitization configuration.',
+              )}
+            />
+          )}
         </div>
       </ControlHeader>
       <CodeEditor
@@ -79,8 +87,9 @@ export const styleControlSetItem: ControlSetItem = {
     valueKey: null,
 
     validators: [],
-    mapStateToProps: ({ controls }) => ({
+    mapStateToProps: ({ controls, common }) => ({
       value: controls?.handlebars_template?.value,
+      htmlSanitization: common?.conf?.HTML_SANITIZATION ?? true,
     }),
   },
 };