Skip to content
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
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Set correct defaultRender for no results found",
"packageName": "@fluentui/react",
"email": "gcox@microsoft.com",
"dependentChangeType": "patch"
}
22 changes: 12 additions & 10 deletions packages/react/src/components/pickers/Suggestions/Suggestions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,18 @@ export class Suggestions<T> extends React.Component<ISuggestionsProps<T>, ISugge
className: css('ms-Suggestions-spinner', legacyStyles.suggestionsSpinner),
};

const noResults = () => (
// This ID can be used by the parent to set aria-activedescendant to this
<div id="sug-noResultsFound" role="option">
{onRenderNoResultFound ? (
onRenderNoResultFound(undefined, noResults)
) : (
<div className={this._classNames.noSuggestions}>{noResultsFoundText}</div>
)}
</div>
);
const noResults = () => {
const defaultRender = () => {
return <div className={this._classNames.noSuggestions}>{noResultsFoundText}</div>;
};

return (
// This ID can be used by the parent to set aria-activedescendant to this
<div id="sug-noResultsFound" role="option">
{onRenderNoResultFound ? onRenderNoResultFound(undefined, defaultRender) : defaultRender()}
</div>
);
};

// MostRecently Used text should supercede the header text if it's there and available.
let headerText: string | undefined = suggestionsHeaderText;
Expand Down