Skip to content

fix(Selector): forward extra HTML attributes from XDSBaseProps#1444

Merged
cixzhang merged 1 commit into
mainfrom
navi/fix/selector-html-attrs
Apr 17, 2026
Merged

fix(Selector): forward extra HTML attributes from XDSBaseProps#1444
cixzhang merged 1 commit into
mainfrom
navi/fix/selector-html-attrs

Conversation

@cixzhang

@cixzhang cixzhang commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

Summary

XDSSelector accepts XDSBaseProps (which extends React.HTMLAttributes), but was destructuring only xstyle, className, style, and data-testid — silently dropping all other HTML attributes (data-*, aria-*, title, onFocus, onBlur, etc.).

Fix

  • Collect remaining props with a ...rest spread in the destructuring
  • Forward ...rest onto the trigger <button> element
  • Extract hasClear from the destructuring (was previously accessed via 'hasClear' in props) to prevent it from leaking to the DOM

This matches the pattern used by XDSButton and other components that extend XDSBaseProps.

Fixes #1415


XDSSelector destructured only specific props from XDSBaseProps (xstyle,
className, style, data-testid) and silently dropped all other HTML
attributes like data-*, aria-*, title, onFocus, onBlur, etc.

Collect remaining props with a rest spread and forward them to the
trigger <button> element, matching the pattern used by XDSButton and
other components.

Fixes #1415
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@xds/core 15.8KB 24.7KB 3.7KB

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@cixzhang
cixzhang merged commit c433198 into main Apr 17, 2026
16 checks passed
@cixzhang
cixzhang deleted the navi/fix/selector-html-attrs branch April 25, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

XDSSelector: extra HTML attributes from XDSBaseProps not forwarded to DOM

1 participant