You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a some components the use HTMLElement instead of the exact typing, which most of them use the exact typing (HTMLDivElement, HTMLSpanElement, etc...)
Fixed the ref type for Combobox.Icon from HTMLDivElement to HTMLSpanElement to correctly match the rendered element type.
Changed forwardedRef parameter type in ComboboxIcon.tsx:12 from React.ForwardedRef<HTMLDivElement> to React.ForwardedRef<HTMLSpanElement>
The component renders a <span> element (line 16) and its props type already correctly specified BaseUIComponentProps<'span', ...> (line 32)
This aligns with existing test expectations (refInstanceof: window.HTMLSpanElement in ComboboxIcon.test.tsx:8)
Follows the same pattern used by other icon components like SelectIcon that also render <span> elements
Confidence Score: 5/5
This PR is safe to merge with no risk
The change is a straightforward type correction that fixes a mismatch between the ref type and the actual rendered element. The fix aligns with existing test expectations, matches the pattern used by similar components, and makes the types consistent across the component definition.
No files require special attention
Important Files Changed
Filename
Overview
packages/react/src/combobox/icon/ComboboxIcon.tsx
Fixed ref type from HTMLDivElement to HTMLSpanElement to match the rendered element and component props type
From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section.
This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".
We have a some components the use HTMLElement instead of the exact typing, which most of them use the exact typing (HTMLDivElement, HTMLSpanElement, etc...)
Is there a reason to have this distinction?
Some of my reasoning in this PR #3638. Depends if it's likely to be polymorphic or not. Though for typesafety, the ref can be attached to the rendered element itself anyway: <Button ref={buttonRef} render={<div ref={divRef} />} />
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3790
We have a some components the use
HTMLElementinstead of the exact typing, which most of them use the exact typing (HTMLDivElement,HTMLSpanElement, etc...)Is there a reason to have this distinction?
packages/react/src/button/Button.tsxHTMLElementbuttonHTMLButtonElementpackages/react/src/checkbox/root/CheckboxRoot.tsxHTMLElementspanHTMLSpanElementpackages/react/src/radio/root/RadioRoot.tsxHTMLElementspanHTMLSpanElementpackages/react/src/switch/root/SwitchRoot.tsxHTMLElementspanHTMLSpanElementpackages/react/src/tabs/tab/TabsTab.tsxHTMLElementbuttonHTMLButtonElementpackages/react/src/accordion/trigger/AccordionTrigger.tsxHTMLElementbuttonHTMLButtonElementpackages/react/src/popover/trigger/PopoverTrigger.tsxHTMLElementbuttonHTMLButtonElementpackages/react/src/menu/item/MenuItem.tsxHTMLElementdivHTMLDivElementpackages/react/src/menu/checkbox-item/MenuCheckboxItem.tsxHTMLElementdivHTMLDivElementpackages/react/src/menu/radio-item/MenuRadioItem.tsxHTMLElementdivHTMLDivElementpackages/react/src/menu/submenu-trigger/MenuSubmenuTrigger.tsxHTMLElementdivHTMLDivElementpackages/react/src/select/item/SelectItem.tsxHTMLElementdivHTMLDivElement