feat(PowerSearch): add popoverMaxWidth prop - #5675
Conversation
…capping Add an optional popoverMaxWidth prop that applies max-width: min(Npx, anchor-size(width)) to the filter-editor popover. This allows consumers anchoring PowerSearch to a wide bar to cap the editor popover at a readable width, without hardcoding a global limit. When omitted, behavior is unchanged (popover stretches to anchor width).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsPowerSearch (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 serious. PowerSearch - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
left a comment
There was a problem hiding this comment.
The legibility problem is real, but popoverMaxWidth puts an internal readability policy at every callsite. It also does not behave as documented below 400px because the existing minimum wins; the current test stays green when the cap is ineffective, and generated docs duplicate the prop.
Please define one internal readable width and keep the clamped editor near the interaction point rather than adding this public prop.
[Reviewed by Robohands]
Summary
Adds an optional
popoverMaxWidthprop toPowerSearchthat caps the filter-editor popover width while ensuring it never exceeds the anchor width.Problem
When
PowerSearchis anchored to a full-width bar (e.g. a page-wide filter bar), the editor popover stretches to match the bar — often 1000px+ — making the 2–3 field form inside it needlessly wide and harder to scan.There is currently no way for consumers to constrain this:
menuWidthonly affects the field/search dropdown, not the editor popover. The popover layer styles are hardcoded with no prop or CSS variable escape hatch.Solution
A single optional prop:
When set, applies
max-width: min(Npx, anchor-size(width))to the editor popover layer. This means:The
min()clamp guarantees the popover never exceeds its anchor regardless of the value passed.Changes
PowerSearch.tsx: newpopoverMaxWidthprop, applied as inlinestyle.maxWidthon the popover render callPowerSearch.test.tsx: test verifying the style is appliedPowerSearch.doc.mjs: prop documented in all locale sections