Bug 6584 REGRESSION: button after unclosed button gives trouble

There should be two separate buttons instead of button "test2" being nested inside button "test".