Fix popover event handler bugs.

- Stop stackable trigger click event propagation.
- Only attach document click/escape listeners when popover is shown.
- Some clean up.