Skip to content

Commit

Permalink
feat(select): dont highlight first option on open
Browse files Browse the repository at this point in the history
  • Loading branch information
reme3d2y committed Jul 9, 2021
1 parent 3bfbe70 commit 015a084
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 21 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/select/src/Component.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ describe('Select', () => {
const input = document.querySelector('.input') as HTMLElement;
await pressArrowDownNTimes(input, options.length + 1);
expect((document.querySelector('.highlighted div') as HTMLElement).innerHTML).toBe(
options[1].content,
options[0].content,
);
});

Expand Down Expand Up @@ -425,7 +425,7 @@ describe('Select', () => {
const expectedProps: Partial<OptionsListProps> = {
options,
flatOptions: options,
highlightedIndex: 0,
highlightedIndex: -1,
open: true,
size: 'l',
visibleOptions: 3,
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/select/src/components/base-select/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const BaseSelect = forwardRef(
circularNavigation,
items: flatOptions,
itemToString,
defaultHighlightedIndex: selectedItems.length === 0 ? 0 : undefined,
defaultHighlightedIndex: selectedItems.length === 0 ? -1 : undefined,
onIsOpenChange: changes => {
if (onOpen) {
onOpen({
Expand Down

0 comments on commit 015a084

Please sign in to comment.