mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: remove first item selection (#7596)
This commit is contained in:
		
							parent
							
								
									0a4ef3b49f
								
							
						
					
					
						commit
						7d88b901a3
					
				@ -171,12 +171,6 @@ export const CommandBar = () => {
 | 
				
			|||||||
        debouncedSetSearchState(value);
 | 
					        debouncedSetSearchState(value);
 | 
				
			||||||
    }, [searchedFlagCount]);
 | 
					    }, [searchedFlagCount]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    useEffect(() => {
 | 
					 | 
				
			||||||
        if (!searchLoading) {
 | 
					 | 
				
			||||||
            selectFirstItem();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }, [searchLoading, searchString]);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    const onSearchChange = (value: string) => {
 | 
					    const onSearchChange = (value: string) => {
 | 
				
			||||||
        debouncedSetSearchState(value);
 | 
					        debouncedSetSearchState(value);
 | 
				
			||||||
        setValue(value);
 | 
					        setValue(value);
 | 
				
			||||||
@ -271,13 +265,6 @@ export const CommandBar = () => {
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const selectFirstItem = () => {
 | 
					 | 
				
			||||||
        const itemsAndIndex = findCommandBarLinksAndSelectedIndex();
 | 
					 | 
				
			||||||
        if (!itemsAndIndex) return;
 | 
					 | 
				
			||||||
        const { allCommandBarLinks } = itemsAndIndex;
 | 
					 | 
				
			||||||
        (allCommandBarLinks[0] as HTMLElement).focus();
 | 
					 | 
				
			||||||
    };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    useOnClickOutside([searchContainerRef], hideSuggestions);
 | 
					    useOnClickOutside([searchContainerRef], hideSuggestions);
 | 
				
			||||||
    const onKeyDown = (event: React.KeyboardEvent) => {
 | 
					    const onKeyDown = (event: React.KeyboardEvent) => {
 | 
				
			||||||
        if (event.key === 'Escape') {
 | 
					        if (event.key === 'Escape') {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user