elements icon indicating copy to clipboard operation
elements copied to clipboard

Bug: Only one selected item is shown in the input while using vscode-multi-select combobox property

Open anitbehera opened this issue 4 months ago • 3 comments

Image

  • Using combobox property in vscode-multi-select
  • 2 options are pre-selected (Afghanistan, Albania)
  • In the searchbox, only the one option is being displayed.
  • Even user de-selects all the options, still the value doesn't disappear.

Expected Behaviour

  • None of the selected option should be displayed in the search input OR all the selected options should be displayed

Using vscode-elements - v2.3.0 Sample Code (React + vite) -

import "@vscode-elements/elements/dist/vscode-multi-select";
import "@vscode-elements/elements/dist/vscode-option";

function App() {
  const countries = [
    { name: "Afghanistan", selected: true },
    { name: "Albania", selected: true },
    { name: "Algeria", selected: false },
  ];
  return (
    <>
      <p> Sample vscode-elem</p>
      <vscode-multi-select id="combobox-example" combobox>
        {countries.map((country) => (
          <vscode-option key={country.name} selected={country.selected}>
            {country.name}
          </vscode-option>
        ))}
      </vscode-multi-select>
    </>
  );
}
export default App;

Also, could you please let me know if there's a way to identify whether an option is selected or deselected, and capture its value accordingly.

anitbehera avatar Aug 29 '25 04:08 anitbehera

Thanks for the report!

Also, could you please let me know if there's a way to identify whether an option is selected or deselected, and capture its value accordingly.

You can use the options, the selectedIndexes and the value property. Also "change" and "input" events are dispatched when the selection is changed.

const el = document.querySelector('vscode-multi-select');
console.log(el.options);
console.log(el.selectedIndexes);
console.log(el.value);

bendera avatar Aug 29 '25 21:08 bendera

Available starting from 2.3.1-pre.2

bendera avatar Sep 12 '25 22:09 bendera

@bendera This issue is fixed, but a new issue has been introduced.

  • When user searches and selects an option from the search result, it's not being selected.
  • But if user searches only the FIRST option and selects, it works as expected. Doesn't work for other options in the search result.

Image

anitbehera avatar Sep 15 '25 06:09 anitbehera