-
Notifications
You must be signed in to change notification settings - Fork 15.7k
fix(modals): use Modal.useModal hook for proper dark mode theming #35198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
// 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.
There was a problem hiding this 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 |
---|---|---|
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.
const themedConfirm = (props: Parameters<typeof AntdModal.confirm>[0]) => | ||
AntdModal.confirm(props); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
f0327d2
to
542949f
Compare
There was a problem hiding this 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 |
---|---|---|
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.
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.
This comment was marked as resolved.
Sorry, something went wrong.
🎪 Showtime deployed environment on GHA for 542949f • Environment: http://34.215.184.202:8080 (admin/admin) |
72ce58c
to
d37caf9
Compare
8f3dd6a
to
5cd88c5
Compare
…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]>
5cd88c5
to
0d61441
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
Fixes dark mode theming issues in modal confirmation dialogs by replacing
Modal.confirm()
with theModal.useModal()
hook approach.Problem
Modal.confirm()
bypasses the theme provider context by rendering directly todocument.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
useModal
hook instead of static methodTechnical Details
Before: Modals rendered directly to body, bypassing theme context:
After: Modals rendered within component tree with theme context:
Test Plan
Modal.useModal
hook usage instead of directModal.confirm
🤖 Generated with Claude Code