html: track hidden state depth in the state data