Skip to content

Conversation

eschutho
Copy link
Member

@eschutho eschutho commented Sep 18, 2025

Summary

Fixes dark mode theming issues in modal confirmation dialogs by replacing Modal.confirm() with the Modal.useModal() hook approach.

Problem

Modal.confirm() bypasses the theme provider context by rendering directly to document.body. This causes confirmation modals to appear with default Ant Design styling instead of the current theme styling, breaking the user experience in dark mode.

Solution

  • Replace Modal.confirm() with modal.confirm(): Use the modal instance from useModal hook instead of static method
  • Add contextHolder to JSX: Render modals within the component tree to inherit theme context
  • Applied to multiple components: Fixed ThemeList and EmbeddedModal components
  • Add comprehensive tests: Verify proper hook usage and prevent regressions

Technical Details

Before: Modals rendered directly to body, bypassing theme context:

Modal.confirm({ ... }); // ❌ Renders to document.body, no theme context

After: Modals rendered within component tree with theme context:

const [modal, contextHolder] = Modal.useModal();
modal.confirm({ ... }); // ✅ Renders within component tree with theme context
return <>{contextHolder}...</>;

Test Plan

  • All existing component tests pass
  • New tests verify Modal.useModal hook usage instead of direct Modal.confirm
  • Tests confirm modal interactions work without DOM errors
  • Tests verify contextHolder is properly rendered for theming
  • TypeScript compilation successful
  • Pre-commit hooks pass (ESLint, type checking)

🤖 Generated with Claude Code

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a theming issue where confirmation dialogs created with Modal.confirm were not respecting dark mode, appearing with white backgrounds instead of the appropriate dark theme colors.

  • Restores the Ant Design App component wrapper in the theme provider to provide theme context for portaled elements
  • Updates the Modal component to use a themed wrapper for confirm dialogs
  • Adds documentation explaining the dependency on the App wrapper for proper theme inheritance

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
superset-frontend/packages/superset-ui-core/src/theme/Theme.tsx Adds App import and wraps children with App component to provide theme context
superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.tsx Introduces themedConfirm wrapper function with documentation for Modal.confirm

};
CustomModal.displayName = 'Modal';

// Theme-aware confirmation modal - now inherits theme through App wrapper in SupersetThemeProvider
Copy link
Preview

Copilot AI Sep 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The themedConfirm function is a simple passthrough that doesn't add any theming logic. Consider adding a comment explaining that the actual theming is handled by the App wrapper in SupersetThemeProvider, or remove this wrapper if it's not adding value beyond documentation.

Suggested change
// Theme-aware confirmation modal - now inherits theme through App wrapper in SupersetThemeProvider
// The themedConfirm function is a simple passthrough to AntdModal.confirm.
// Actual theming is handled by the App wrapper in SupersetThemeProvider.
// This wrapper exists only for documentation and API consistency.

Copilot uses AI. Check for mistakes.

@dosubot dosubot bot added change:frontend Requires changing the frontend global:theming Related to theming Superset labels Sep 18, 2025
@eschutho eschutho marked this pull request as draft September 18, 2025 22:07
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Performance Unnecessary function wrapper adds runtime overhead ▹ view ✅ Fix detected
Files scanned
File Path Reviewed
superset-frontend/packages/superset-ui-core/src/theme/Theme.tsx
superset-frontend/packages/superset-ui-core/src/components/Modal/Modal.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

Comment on lines 372 to 373
const themedConfirm = (props: Parameters<typeof AntdModal.confirm>[0]) =>
AntdModal.confirm(props);

This comment was marked as resolved.

@pull-request-size pull-request-size bot added size/L and removed size/S labels Sep 18, 2025
@eschutho eschutho force-pushed the fix/modal-confirm-dark-mode-theming branch from f0327d2 to 542949f Compare September 18, 2025 23:39
@github-actions github-actions bot removed the packages label Sep 18, 2025
@eschutho eschutho added the 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR label Sep 18, 2025
@github-actions github-actions bot added 🎪 542949f 🚦 building Environment 542949f status: building 🎪 542949f 📅 2025-09-18T23-41 Environment 542949f created at 2025-09-18T23-41 🎪 542949f ⌛ 48h Environment 542949f expires after 48h 🎪 542949f 🤡 eschutho Environment 542949f requested by eschutho and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR labels Sep 18, 2025
Copy link
Contributor

🎪 Showtime is building environment on GHA for 542949f

@github-actions github-actions bot added 🎪 542949f 🚦 deploying Environment 542949f status: deploying and removed 🎪 542949f 🚦 building Environment 542949f status: building labels Sep 18, 2025
@eschutho eschutho marked this pull request as ready for review September 18, 2025 23:51
Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Status
Functionality Inconsistent modal theming implementation ▹ view 🧠 Not in standard
Files scanned
File Path Reviewed
superset-frontend/src/dashboard/components/EmbeddedModal/index.tsx
superset-frontend/src/pages/ThemeList/index.tsx

Explore our documentation to understand the languages and file types we support and the files we ignore.

Check out our docs on how you can make Korbit work best for you and your team.

Loving Korbit!? Share us on LinkedIn Reddit and X

const [appliedThemeId, setAppliedThemeId] = useState<number | null>(null);

// Use Modal.useModal hook to ensure proper theming
const [modal, contextHolder] = Modal.useModal();

This comment was marked as resolved.

@github-actions github-actions bot added 🎪 542949f 🚦 running Environment 542949f status: running 🎪 🎯 542949f Active environment pointer - 542949f is receiving traffic 🎪 542949f 🌐 34.215.184.202:8080 Environment 542949f URL: http://34.215.184.202:8080 (click to visit) and removed 🎪 542949f 🚦 deploying Environment 542949f status: deploying 🎪 542949f 🚦 running Environment 542949f status: running labels Sep 18, 2025
@github-actions github-actions bot removed the 🎪 🎯 542949f Active environment pointer - 542949f is receiving traffic label Sep 18, 2025
Copy link
Contributor

🎪 Showtime deployed environment on GHA for 542949f

Environment: http://34.215.184.202:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

@msyavuz msyavuz self-requested a review September 19, 2025 17:34
@github-actions github-actions bot removed 🎪 542949f 📅 2025-09-18T23-41 Environment 542949f created at 2025-09-18T23-41 🎪 542949f 🌐 34.215.184.202:8080 Environment 542949f URL: http://34.215.184.202:8080 (click to visit) 🎪 542949f 🚦 running Environment 542949f status: running 🎪 542949f 🤡 eschutho Environment 542949f requested by eschutho 🎪 542949f ⌛ 48h Environment 542949f expires after 48h labels Sep 21, 2025
@eschutho eschutho changed the title fix(modals): restore App wrapper to fix Modal.confirm dark mode theming fix(modals): use Modal.useModal hook for proper dark mode theming Sep 24, 2025
@eschutho eschutho force-pushed the fix/modal-confirm-dark-mode-theming branch 2 times, most recently from 72ce58c to d37caf9 Compare September 25, 2025 17:09
@pull-request-size pull-request-size bot added size/S and removed size/L labels Sep 25, 2025
@eschutho eschutho force-pushed the fix/modal-confirm-dark-mode-theming branch 2 times, most recently from 8f3dd6a to 5cd88c5 Compare September 25, 2025 17:44
@pull-request-size pull-request-size bot added size/L and removed size/S labels Sep 25, 2025
…on dialogs

Replaces Modal.confirm() with Modal.useModal() hook to ensure proper theming support in confirmation dialogs. This fixes dark mode theming issues where confirmation modals were not inheriting the correct theme context.

Changes:
- Add Modal.useModal() hook to DashboardEmbedControls component
- Replace Modal.confirm() with modal.confirm() for disable confirmation
- Add contextHolder to component JSX for proper modal theming
- Update dependency array to include modal instance

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@eschutho eschutho force-pushed the fix/modal-confirm-dark-mode-theming branch from 5cd88c5 to 0d61441 Compare September 25, 2025 23:26
Copy link
Member

@mistercrunch mistercrunch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change:frontend Requires changing the frontend global:theming Related to theming Superset preset-io size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants