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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 12 additions & 5 deletions src/components/Dropdown/DropdownItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useDropdownContext } from './DropdownContext';
import { FocusedItemData, useFocusContext } from './FocusContext';
import { generateDropdownId } from './generateDropdownId';
import { useInputContext } from './InputContext';
import { twMerge } from '../../hooks/useComposedCssClasses';

/**
* Props for the {@link DropdownItem}.
Expand Down Expand Up @@ -69,19 +70,25 @@ export function DropdownItemWithIndex(props: DropdownItemProps & { index: number
value
]);

const baseButtonClasses = 'bg-transparent border-0 p-0 m-0 font-inherit text-inherit text-left '
+ 'cursor-pointer w-full self-stretch box-border';
const combinedClassName = twMerge(
baseButtonClasses,
isFocused ? focusedClassName ?? '' : className ?? ''
);

return (
// eslint-disable-next-line jsx-a11y/anchor-is-valid
<a
<button
id={generateDropdownId(screenReaderUUID, index)}
href="#"
type="button"
tabIndex={-1}
className={isFocused ? focusedClassName : className}
className={combinedClassName}
onClick={handleClick}
aria-label={typeof ariaLabel === 'function' ? ariaLabel(value) : ariaLabel}
role="option"
aria-selected={isFocused}
>
{children}
</a>
</button>
);
}
2 changes: 1 addition & 1 deletion test-site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions test-site/src/pages/LocationsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function LocationsPage() {
top: scrollTop,
behavior: "smooth",
});
}
}
}, [resultsRef.current, resultsContainer])

const markerOptionsOverride = useCallback((selected: boolean) => {
Expand All @@ -90,7 +90,8 @@ export function LocationsPage() {
label='FilterSearch Location Filter'
customCssClasses={
{
currentLocationAndInputContainer: 'w-1/5'
currentLocationAndInputContainer: 'w-1/5',
focusedOption: 'bg-red-500'
}
}
showCurrentLocationButton={true}
Expand Down Expand Up @@ -146,4 +147,4 @@ export function LocationsPage() {
// </div>
// </div>
// )
}
}
7 changes: 4 additions & 3 deletions test-site/src/pages/UniversalPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ const universalVerticalConfigMap = {
};

const customSearchBarCss = {
searchBarContainer: 'mb-3 text-emerald-800'
searchBarContainer: 'mb-3 text-emerald-800',
focusedOption: "bg-emerald-200",
};

function CustomCitationCard(props: CitationProps): React.JSX.Element | null {
Expand Down Expand Up @@ -95,7 +96,7 @@ export default function UniversalPage(): React.JSX.Element {
universalAutocompleteLimit={20}
/>
<SpellCheck />
<GenerativeDirectAnswer
<GenerativeDirectAnswer
answerHeader='A custom answer header'
CitationCard={CustomCitationCard}
/>
Expand Down Expand Up @@ -130,4 +131,4 @@ export default function UniversalPage(): React.JSX.Element {
/> */}
</div>
);
}
}