ITADN

[dropdown] selected sub-menu value does not show on initialization

#3439OpenGammaGames 创建于 2026-01-26
type/bugtype/duplicatefixed in next-release/nightly
G
GammaGamescommented
# Bug Report I'm setting up a dropdown through code and a sub-menu item doesn't get set selected on initialization. ## Steps to reproduce 1. Create dropdown with a menu type value 2. Set one of the menu items to selected 3. Item is not selected ```javascript $('.ui.dropdown#catitem').dropdown({ allowCategorySelection: true, values: [ { name: 'One', value: 'one' }, { name: 'Two', value: 'two' }, { name: 'Three', value: 'three' }, { name: 'Category', value: 'category', type: 'menu', values: [ { name: 'CatOne', value: 'one', selected: true }, { name: 'CatTwo', value: 'two' }, ], }, ], }); ``` It does work if you call `.dropdown('set selected', 'one');` after initialization though ## Expected result <img width="395" height="74" alt="Image" src="https://github.com/user-attachments/assets/55bfe093-708d-4dd4-bca5-86acd2312011" /> ## Actual result <img width="393" height="75" alt="Image" src="https://github.com/user-attachments/assets/e38f2f39-6172-4778-b195-50bb9e6a2be7" /> ## Testcase https://jsfiddle.net/m1krqd3p/ ## Screenshot (if possible) <img width="803" height="153" alt="Image" src="https://github.com/user-attachments/assets/df169737-5c28-4662-b6cb-710190d38a7b" /> ## Version 2.9.4
1 条评论