Blueprint: Make activeItem on <Popover> open match selectedItem in <Suggest> if selectedItem is defined

Created on 6 Oct 2019  路  5Comments  路  Source: palantir/blueprint

Environment

  • __Package version(s)__: @blueprintjs/[email protected]
  • __Browser and OS versions__: all

Feature request

Currently the activeItem for (and probably other select package components) defaults to the first item in the list. If a Select component is used as a controlled component and a value is set then activeItem should be set to the selectedItem when the Popover menu is opened so that the user sees the activeItem as the currently selectedItem.

It would be nice as a dev to have this functionality out of the box without having to write extra code to handle keeping track of the active item every time I use this component.

Adding a "defaultActiveItemToSelectedItem" or some other prop to enable this feature could also work.

Examples

This shows the activeItem defaulting to the first in the list.

https://codesandbox.io/s/blueprint-sandbox-lir2r?fontsize=14

select enhancement help wanted

Most helpful comment

Just want to say thanks for taking care of this!

All 5 comments

Sounds like a good enhancement, accepting PRs

I'll try to put something together this week. Is it OK to make this the default behavior of the component? Or add a prop to enable? Personally I think this functionality should be the default.

@skurger I would prefer to enable it by default

Just want to say thanks for taking care of this!

Which reminds me this should make its way to the