microsoft / vscode-webview-ui-toolkit

A component library for building webview-based extensions in Visual Studio Code.
MIT License
2.02k stars 142 forks source link

vscode-dropdown not displaying the selection item #551

Closed davidkjackson54 closed 7 months ago

davidkjackson54 commented 7 months ago

I have tried the suggested method provided here https://github.com/microsoft/vscode-webview-ui-toolkit/tree/main/src/dropdown to create a basic dropdown in my VSCode extension but I am not getting the selected item displayed in the list - The display item remains blank when selected.

My code:

<div class="dropdown-container">
        <label for="list">Choose an option:</label>
        <vscode-dropdown id="list">
          <vscode-option>Option Label #1</vscode-option>
          <vscode-option>Option Label #2</vscode-option>
          <vscode-option>Option Label #3</vscode-option>
        </vscode-dropdown>
</div>

However the display remains blank when an item is selected here is the dropdown. image

I select option 2 and the dropdown list correctly disappears but the selected item is not presented in the box image

ALso - as a second issue. I have tried this: <vscode-option selected>Option Label #2</vscode-option>

but the item is not displayed as a default selection.