{
const id = this._id;
return (
- {options.map((item) => (onRenderItem as any)(item, this._onRenderItem))}
+ { options.map((item) => (onRenderItem as any)(item, this._onRenderItem)) }
);
}
@@ -1002,8 +1002,8 @@ export class ComboBox extends BaseComponent {
return (
);
}
@@ -1039,8 +1039,8 @@ export class ComboBox extends BaseComponent {
onMouseMove={ this._onOptionMouseMove.bind(this, item.index) }
onMouseLeave={ this._onOptionMouseLeave }
role='option'
- aria-selected={ isSelected ? 'true' : 'false'}
- ariaLabel= {item.text }
+ aria-selected={ isSelected ? 'true' : 'false' }
+ ariaLabel={ item.text }
disabled={ item.disabled }
> {
{ onRenderOption(item, this._onRenderOptionContent) }
@@ -1048,23 +1048,23 @@ export class ComboBox extends BaseComponent {
}
) : (
-
- {onRenderOption(item, this._onRenderOptionContent)}
-
- )
+
+ { onRenderOption(item, this._onRenderOptionContent) }
+
+ )
);
}
@@ -1187,7 +1187,7 @@ export class ComboBox extends BaseComponent {
private _onRenderOptionContent = (item: IComboBoxOption): JSX.Element => {
const optionClassNames = getComboBoxOptionClassNames(this._getCurrentOptionStyles(item));
- return {item.text};
+ return { item.text };
}
/**
@@ -1325,7 +1325,30 @@ export class ComboBox extends BaseComponent {
currentOptions
} = this.state;
- index = this._getNextSelectableIndex(index, searchDirection);
+ // update index to allow content to wrap
+ if (searchDirection === SearchDirection.forward && index >= currentOptions.length - 1) {
+ index = -1;
+ } else if (searchDirection === SearchDirection.backward && index <= 0) {
+ index = currentOptions.length;
+ }
+
+ // get the next "valid" index
+ const indexUpdate = this._getNextSelectableIndex(index, searchDirection);
+
+ // if the two indicies are equal we didn't move and
+ // we should attempt to get get the first/last "valid" index to use
+ // (Note, this takes care of the potential cases where the first/last
+ // item is not focusable), otherwise use the updated index
+ if (index === indexUpdate) {
+ if (searchDirection === SearchDirection.forward) {
+ index = this._getNextSelectableIndex(-1, searchDirection);
+ } else if (searchDirection === SearchDirection.backward) {
+ index = this._getNextSelectableIndex(currentOptions.length, searchDirection);
+ }
+ } else {
+ index = indexUpdate;
+ }
+
if (this._indexWithinBounds(currentOptions, index)) {
this._setPendingInfoFromIndex(index);
}