Fix a problem with nested hide support to make sure to get the deactivate calls right

This also impacted the history support where it is setting up a hide based upon the history.  And add another test for this.