Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding CSS property to active descendant #364

Open
SudoHaugen opened this issue May 3, 2021 · 1 comment
Open

Adding CSS property to active descendant #364

SudoHaugen opened this issue May 3, 2021 · 1 comment

Comments

@SudoHaugen
Copy link

SudoHaugen commented May 3, 2021

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
When highLightFirstSuggestion prop is set to true, the active descendant has a very light background which is difficult to see. Is there a way to adjust this CSS property?

Which versions of ReactPlacesAutocomplete, and which browser / OS are affected by this issue?
^7.3.0

@davidgs
Copy link

davidgs commented Jan 1, 2023

Here's how I'm setting the foreground and background of the suggestions:

<div>
        {loading && <div>Loading...</div>}
        {suggestions.map((suggestion) => {
               const style = suggestion.active
                  ? { backgroundColor: "#2C74B3", cursor: "pointer" }
                   : { backgroundColor: "#ffffff", cursor: "pointer" };
               return (
                   <div {...getSuggestionItemProps(suggestion, { style })}>
                          {suggestion.description}
                   </div>
                );
         })}
</div>

This sets the selection floor to a light blue and the background color to white. You can change those values as you see fit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants