Enhance createPopup() API to support key callback