Hide popover when doc is edited or changes

This is for #3484 and #3513.