Skip to content

[ZEPPELIN-6588] Use theme colors in the pivot and scatter settings panels - #5504

Open
kimyenac wants to merge 1 commit into
apache:masterfrom
kimyenac:ZEPPELIN-6588
Open

kimyenac wants to merge 1 commit into
apache:masterfrom
kimyenac:ZEPPELIN-6588

Conversation

@kimyenac

Copy link
Copy Markdown
Contributor

What is this PR for?

In dark mode the Pivot and Scatter visualization settings panels were unreadable. Both components hard-coded light backgrounds on their cards (#fff) and card headers (#fafafa), but the card titles take the theme's heading color. So in dark mode the titles were near-white text on a white background. The field labels (.drag-tag, defined in global.less) also stayed light.

This PR replaces those values with the existing theme variables. It adds no new colors, and the light theme resolves to the same values as before.

Element Before After
Card background #fff @component-background
Card header background #fafafa @background-color-light
Field label text / background / border rgba(0,0,0,.65) / #fafafa / #d9d9d9 @text-color / @background-color-light / @border-color-base

The cards already sit inside .themeMixin(...), so their fix is a one-line swap in each file. The field label styles are only used by these two panels, but they stay in global.less. The CDK drag preview is appended to <body>, outside the component host, so a component-scoped rule would not reach the label being dragged. Dark values are applied under html.dark .drag-tag { @import 'theme-dark'; ... }, the same pattern antd-dark.less uses.

Computed styles measured in the browser, before and after (/#/notebook/... with a %sh table paragraph, Pivot through the Bar Chart and Scatter through the Scatter Chart):

Dark theme Before After
Card rgb(255, 255, 255) rgb(31, 31, 31)
Card header rgb(250, 250, 250) rgb(38, 38, 38)
Card title rgba(255, 255, 255, 0.95) (on white) rgba(255, 255, 255, 0.95)
Field label bg / text rgb(250, 250, 250) / rgba(0, 0, 0, 0.65) rgb(38, 38, 38) / rgba(255, 255, 255, 0.85)
Drag preview (child of <body>) same as field label, light rgb(38, 38, 38) / rgba(255, 255, 255, 0.85)

The "before" row matches the values in the Jira report. In the light theme, every value above is identical before and after, including the drag preview. The compiled .drag-tag rule is character-for-character the same as before.

What type of PR is it?

Bug Fix

Todos

  • Use theme variables for the Pivot and Scatter settings card and header backgrounds
  • Theme the field labels, including the drag preview
  • Add Playwright coverage for both panels in both themes

What is the Jira issue?

ZEPPELIN-6588

How should this be tested?

Done:

  • New spec e2e/tests/theme/visualization-settings-theme.spec.ts: Pivot and Scatter, each in light and dark (4 tests). Each test checks every card, card header and card title, plus a field label, against the theme's resolved colors. The table paragraph fixture moved to notebook-visualization-page.ts, so this spec and visualization-rendering.spec.ts share it.
  • Ran the new spec against the unfixed styles. The two dark tests fail on the card background (expected rgb(31, 31, 31), received rgb(255, 255, 255)), and the two light tests pass. With only the global.less change reverted, the dark tests get past the cards and fail on the field label (expected rgb(38, 38, 38), received rgb(250, 250, 250)). So both assertions catch the defect.
  • With the fix, the new spec plus visualization-rendering.spec.ts pass on chromium, firefox and webkit: 19 passed, no retries.
  • npm run test:shell: 131 passed. npm run lint: exit 0, with the same warning count as master.
  • Manual check on a local server in both themes: card titles and field labels are readable, dragging a field between Keys/Groups/Values still works, and the light theme looks unchanged.

Notes:

  • Not tagged with @NB-PARITY-060 (theme). That scenario's action is changing the theme while a notebook is mounted, but this spec sets the theme in localStorage and reloads. Tagging it would also mean updating the registry coverage that ZEPPELIN-6640 tracks.
  • Drag-and-drop was checked by hand but has no new automated coverage. Behavior coverage for these panels is ZEPPELIN-6514.
  • Unrelated existing behavior found while testing, present on master too: reload a note whose saved mode is Scatter, switch to Bar and back to Scatter, and the Scatter settings panel stays hidden while Setting shows it as open. Each test here uses a fresh note, so it does not hit this.

Screenshots (if appropriate)

N/A. The computed-style tables above record the before/after values.

Questions:

  • Does the license files need to update? No. The new spec has the ASF header.
  • Is there breaking changes for older versions? No. Light theme output is unchanged.
  • Does this needs documentation? No.

🤖 Generated with Claude Code

…nels

The Pivot and Scatter settings panels hard-coded light backgrounds on their
cards (#fff) and card headers (#fafafa), while the card titles inherit the
theme's heading color. In dark mode this put near-white titles on a white
background. The global .drag-tag field labels likewise stayed light.

Use the existing theme variables instead: @component-background and
@background-color-light for the cards, and @text-color,
@background-color-light and @border-color-base for the field labels, with a
dark override under html.dark. The label styles stay global because the CDK
drag preview is appended to <body>. The light theme values are unchanged.

Add a Playwright spec that checks both panels in both themes, and share the
table paragraph fixture from the visualization page object.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant