Skip to content

fix(native-filters): keep filter value input caret left-aligned - #42266

Closed
fitzee wants to merge 1 commit into
apache:masterfrom
fitzee:sc-114099-filter-bar-cursor
Closed

fitzee wants to merge 1 commit into
apache:masterfrom
fitzee:sc-114099-filter-bar-cursor

Conversation

@fitzee

@fitzee fitzee commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

When clicking into a dashboard native-filter value control (e.g. a multi-select filter), the caret and the placeholder/typed text render centered instead of left-aligned.

This is a regression from the Ant Design v6 upgrade. antd v6 emits text-align: center directly on .ant-select-multiple .ant-select-content (its own css-in-js). The Select search <input> lives inside .ant-select-content and resolves text-align by inheritance, so the caret/text inherit the centered value.

Fix: in the shared FilterPluginStyle wrapper used by all native filter value plugins, pin text-align: start and override .ant-select .ant-select-content directly. Overriding the element itself is required because a value inherited from an ancestor cannot beat a rule that targets .ant-select-content directly. The override's specificity (wrapper class + two antd classes = 0,3,0) beats antd's .ant-select-multiple .ant-select-content (0,2,0) without !important. start is the CSS default, so this is a no-op except where antd leaked the centered alignment, and it's RTL-safe.

Scoped to native filter value controls (Select, Range, Time, TimeColumn, TimeGrain) — no app-wide blast radius.

TESTING INSTRUCTIONS

  1. Add a native filter of type Value (multi-select) to a dashboard.
  2. Click into the filter's input.
  3. The caret and placeholder/typed text should be left-aligned (inline start), not centered.

ADDITIONAL INFORMATION

  • Has associated issue
  • Required feature flags: n/a
  • Changes UI

After the Ant Design v6 upgrade, the placeholder, value and search caret
in a native filter bar Select value control render centered instead of
at the start of the field (reported and confirmed in Firefox devtools on
a multiple Select filter, light and dark themes).

Root cause is antd v6 itself: it injects a rule targeting
.ant-select-content directly for multiple-mode Selects
(:where(.cssHash).ant-select-multiple .ant-select-content, specificity
0,2,0) that sets text-align: center. The Select search input lives inside
.ant-select-content and inherits that alignment, so the caret and typed
text sit in the middle.

Because antd targets .ant-select-content directly, a text-align inherited
from an ancestor wrapper cannot override it. Override the element itself,
scoped to the filter value wrapper: .ant-select .ant-select-content under
the FilterPluginStyle class resolves to specificity 0,3,0, beating antds
0,2,0 without !important. text-align: start keeps it RTL-safe. The wrapper
also keeps text-align: start for the Input/InputNumber value controls
(is-like text filter, numeric range) which resolve alignment by
inheritance.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dosubot dosubot Bot added change:frontend Requires changing the frontend dashboard:native-filters Related to the native filters of the Dashboard labels Jul 21, 2026
@bito-code-review

bito-code-review Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #2cab05

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 3bda48c..3bda48c
    • superset-frontend/src/filters/components/common.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@netlify

netlify Bot commented Jul 21, 2026

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 3bda48c
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a5f2c9bf038ab0008dadd8b
😎 Deploy Preview https://deploy-preview-42266--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment on lines +28 to +30
/* Input / InputNumber filter value controls resolve text-align by */
/* inheritance, so pin them to the inline start to keep the caret and typed */
/* text at the left edge. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: The new comment says text is kept at the “left edge,” but the implemented rule uses text-align: start, which maps to the right edge in RTL; update the comment to describe “inline start” instead to avoid misleading future changes and tests. [comment mismatch]

Severity Level: Minor 🧹
- ⚠️ Comment misleading about RTL alignment of filter inputs.
- ⚠️ No runtime behavior affected; UI works as intended.
Steps of Reproduction ✅
1. Open `superset-frontend/src/filters/components/common.ts` and locate
`FilterPluginStyle` definition at lines 25-44 in the PR diff.

2. Observe the comments at lines 28-30: they mention "inline start" (correct for
`text-align: start`) but also say "text at the left edge."

3. Note the implementation at line 31: `text-align: start;` which, per CSS spec, aligns
text to the right edge in RTL contexts.

4. In an RTL dashboard (where inline start is right), native filter value inputs render
caret/text at the right edge, while the comment still describes "left edge", so the
comment is mildly misleading but behavior is correct.

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** superset-frontend/src/filters/components/common.ts
**Line:** 28:30
**Comment:**
	*Comment Mismatch: The new comment says text is kept at the “left edge,” but the implemented rule uses `text-align: start`, which maps to the right edge in RTL; update the comment to describe “inline start” instead to avoid misleading future changes and tests.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. The CSS property text-align: start aligns text to the right edge in Right-to-Left (RTL) contexts, making the comment "left edge" misleading. You should update the comment to refer to "inline start" to accurately reflect the behavior.

Here is the corrected code snippet:

  /* Input / InputNumber filter value controls resolve text-align by */
  /* inheritance, so pin them to the inline start to keep the caret and typed */
  /* text at the inline start. */
  text-align: start;

I have checked the available PR comments, and there are no other review comments to address. Would you like me to perform any other tasks?

superset-frontend/src/filters/components/common.ts

/* Input / InputNumber filter value controls resolve text-align by */
  /* inheritance, so pin them to the inline start to keep the caret and typed */
  /* text at the inline start. */
  text-align: start;

@codecov

codecov Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.22%. Comparing base (158e321) to head (3bda48c).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #42266   +/-   ##
=======================================
  Coverage   65.22%   65.22%           
=======================================
  Files        2768     2768           
  Lines      156280   156280           
  Branches    35774    35774           
=======================================
  Hits       101933   101933           
  Misses      52382    52382           
  Partials     1965     1965           
Flag Coverage Δ
javascript 70.89% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sadpandajoe
sadpandajoe requested a review from rusackas July 21, 2026 17:14
/* Input / InputNumber filter value controls resolve text-align by */
/* inheritance, so pin them to the inline start to keep the caret and typed */
/* text at the left edge. */
text-align: start;

@sadpandajoe sadpandajoe Jul 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add a focused Jest regression test for this fix? Rendering FilterPluginStyle and asserting each retained text-align: start rule with toHaveStyleRule would protect the corrective CSS; the existing DOM-contract test only protects the Ant Design class hook.

/* text at the left edge. */
text-align: start;

/* antd v6 sets 'text-align: center' directly on '.ant-select-content' for */

@sadpandajoe sadpandajoe Jul 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The locked Ant Design 6.5.1 CSS does not set text-align: center on .ant-select-multiple .ant-select-content; that rule only sets wrapping, item alignment, and line height. Can we keep the wrapper-level rule, remove this nested selector, and document the actual inherited source instead?

@yousoph yousoph left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the CSS change and dug into the root cause. The diff itself is safe — text-align: start is the CSS initial value, RTL-safe, and scoped to native filter value controls — so this is low-risk to land. Two substantive points, plus inline suggestions on the comment wording.

1. The stated root cause doesn't match stock antd. I checked the compiled Select styles across antd 6.0.0 → 6.5.1 (this PR resolves to 6.5.1). In every one of those versions the only text-align: center in the Select style layer is on .ant-select-clear (the clear icon) — there is no rule setting text-align: center on .ant-select-content, for multiple-mode or otherwise. So the comment's claim that "antd v6 sets text-align: center directly on .ant-select-content … specificity 0,2,0" isn't accurate for the version being shipped; a centered alignment on that element would have to come from a theme-level / css-in-js override on the affected deployment rather than upstream antd.

That doesn't make the change wrong — pinning text-align: start is reasonable defensive hardening — but it means on stock OSS this is likely a no-op, and the comment overstates what upstream does. Could you confirm the centered caret actually reproduces on a vanilla OSS build (antd 6.5.1)? If it only shows up under a custom theme, worth saying so. I've suggested reworded comments inline that keep the (sound) specificity reasoning without the upstream claim.

2. There's a byte-identical copy of this wrapper that isn't patched. superset-frontend/src/chartCustomizations/components/common.ts defines the same FilterPluginStyle (used by DynamicGroupBy / TimeColumn / TimeGrain / DeckglLayerVisibility). If this alignment issue is real for those controls too, the fix should be applied there as well — or a note on why it's out of scope. (It's not in this diff, so flagging here rather than inline.)

Minor: the "left edge" phrasing reads as physical-left; "inline start" is the RTL-correct term (covered in the inline suggestion).

Comment on lines +28 to +30
/* Input / InputNumber filter value controls resolve text-align by */
/* inheritance, so pin them to the inline start to keep the caret and typed */
/* text at the left edge. */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reword to avoid the physical-"left" framing (RTL-correct) and cover all three value controls:

Suggested change
/* Input / InputNumber filter value controls resolve text-align by */
/* inheritance, so pin them to the inline start to keep the caret and typed */
/* text at the left edge. */
/* Filter value controls (Input / InputNumber / Select search) resolve */
/* 'text-align' by inheritance, so pin them to the inline start to keep the */
/* caret and typed text at the inline-start edge. */

Comment on lines +33 to +40
/* antd v6 sets 'text-align: center' directly on '.ant-select-content' for */
/* multiple-mode Selects (its selector '.ant-select-multiple */
/* .ant-select-content' has specificity 0,2,0). The Select search input */
/* lives inside '.ant-select-content' and inherits that value, so the caret */
/* and typed text render centered. A value inherited from this wrapper */
/* cannot beat a rule that targets '.ant-select-content' directly, so */
/* override the element itself: this wrapper class plus the two antd classes */
/* give specificity 0,3,0, which wins without !important. RTL-safe. */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Stock antd 6.0.0–6.5.1 doesn't set text-align: center on .ant-select-content (only on .ant-select-clear), so this rewording drops the inaccurate "antd v6 sets…" claim while keeping the specificity reasoning, which is correct:

Suggested change
/* antd v6 sets 'text-align: center' directly on '.ant-select-content' for */
/* multiple-mode Selects (its selector '.ant-select-multiple */
/* .ant-select-content' has specificity 0,2,0). The Select search input */
/* lives inside '.ant-select-content' and inherits that value, so the caret */
/* and typed text render centered. A value inherited from this wrapper */
/* cannot beat a rule that targets '.ant-select-content' directly, so */
/* override the element itself: this wrapper class plus the two antd classes */
/* give specificity 0,3,0, which wins without !important. RTL-safe. */
/* Some deployments (custom themes / css-in-js overrides) can leak a centered */
/* 'text-align' onto '.ant-select-content'. The Select search <input> lives */
/* inside '.ant-select-content' and resolves 'text-align' by inheritance, so */
/* that would center the caret and typed text. Overriding '.ant-select-content' */
/* directly (this wrapper class + two antd classes = specificity 0,3,0) beats */
/* both an inherited value and a '.ant-select-multiple .ant-select-content' */
/* rule without '!important'. 'start' is the CSS default, so this is a no-op */
/* unless a centered value leaked in, and it's RTL-safe. */

@yousoph

yousoph commented Jul 23, 2026

Copy link
Copy Markdown
Member

Superseded by #42323, which reworks this same fix to address review feedback: it keeps the wrapper-level text-align: start, drops the nested .ant-select-content override (Ant Design 6.5.1 doesn't set text-align: center on that element — verified across 6.0.0–6.5.1), documents the actual inherited source, keeps the duplicated chartCustomizations copy in sync, and adds a Jest regression test. Thanks @sadpandajoe for the review here. Closing in favor of #42323.

@yousoph yousoph closed this Jul 23, 2026
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 dashboard:native-filters Related to the native filters of the Dashboard size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants