Fixed null comparison and tertiary-if in keyboard.
Ported basic popup logic from TS to CS.
Should probably clean it up later.