Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ComboBox): add ability to forward ref #9136

Merged
merged 5 commits into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ Map {
},
},
"ComboBox" => Object {
"$$typeof": Symbol(react.forward_ref),
"defaultProps": Object {
"ariaLabel": "Choose an item",
"direction": "bottom",
Expand Down Expand Up @@ -692,6 +693,7 @@ Map {
"type": "node",
},
},
"render": [Function],
},
"ComposedModal" => Object {
"defaultProps": Object {
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/ComboBox/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const findHighlightedIndex = ({ items, itemToString }, inputValue) => {

const getInstanceId = setupGetInstanceId();

const ComboBox = (props) => {
const ComboBox = React.forwardRef((props, ref) => {
const {
ariaLabel,
className: containerClassName,
Expand Down Expand Up @@ -308,7 +308,7 @@ const ComboBox = (props) => {
aria-controls={inputProps['aria-controls']}
{...inputProps}
{...rest}
ref={mergeRefs(textInput, rootProps.ref)}
ref={mergeRefs(textInput, ref)}
/>
{invalid && (
<WarningFilled16
Expand Down Expand Up @@ -387,7 +387,7 @@ const ComboBox = (props) => {
}}
</Downshift>
);
};
});

ComboBox.propTypes = {
/**
Expand Down