@@ -437,12 +437,13 @@ dropdown k0 options (DropdownConfig setK attrs) = do
437437 let xs = fmap (\(ix, (k, v)) -> ((ix, k), ((ix, k), v))) $ zip [0::Int ..] $ Map.toList os
438438 in (Map.fromList $ map snd xs, Bimap.fromList $ map fst xs)
439439 modifyAttrs <- dynamicAttributesToModifyAttributes attrs
440− initialIxKeys <- sample $ current ixKeys
441− let initialValue = maybe "" (T.pack . show) $ Bimap.lookupR k0 initialIxKeys
440+ postBuild <- getPostBuild
441+ let updatedSelection = attachPromptlyDynWithMaybe (flip Bimap.lookupR) ixKeys setK
442+ initialSelection = attachPromptlyDynWithMaybe (flip Bimap.lookupR) ixKeys (k0 <$ postBuild)
443+ selection = leftmost [updatedSelection, initialSelection]
442444 let cfg = def
443445 & selectElementConfig_elementConfig . elementConfig_modifyAttributes .~ fmap mapKeysToAttributeName modifyAttrs
444− & selectElementConfig_setValue .~ fmap (T.pack . show) (attachPromptlyDynWithMaybe (flip Bimap.lookupR) ixKeys setK)
445− & selectElementConfig_initialValue .~ initialValue
446+ & selectElementConfig_setValue .~ fmap (T.pack . show) selection
446447 (eRaw, _) <- selectElement cfg $ listWithKey indexedOptions $ \(ix, k) v -> do
447448 let optionAttrs = fmap (\dk -> "value" =: T.pack (show ix) <> if dk == k then "selected" =: "selected" else mempty) defaultKey
448449 elDynAttr "option" optionAttrs $ dynText v