Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "Fix bug in combo box where _selectedElement ref wasn't being set conditionally",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "keyou@microsoft.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ export class ComboBox extends BaseComponent<IComboBoxProps, IComboBoxState> {
aria-selected={ isSelected ? 'true' : 'false'}
ariaLabel= {item.text }
disabled={ item.disabled }
> { <span ref={ this._selectedElement }>
> { <span ref={ isSelected ? this._selectedElement : '' }>

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.

Since we're trying to move away from string refs perhaps pass a noop?

const noop = () => {};

...

> { <span ref={ isSelected ? this._selectedElement : noop }>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What about undefined? TSLint won't pass with an empty function block

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.

Yeah, I think undefined would be fine, you may need to update the declaration to allow for undefined

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it's fine as is, ref is already an optional prop and passing undefined should just make it not set to anything. I'll push that in a minute

{ onRenderOption(item, this._onRenderOptionContent) }
</span>
}
Expand Down