MATLAB: Uitabgroup seems to ignore stacking order

MATLABuitabgroup

I create an app designer app in R2016b which consists of various ui components, including the following:
  • uitabgroup which occupies the full uifigure
  • multiple uipanels which overlay the uitabgroup, but whose parent is the uifigure
In R2016b, the panels showed up just fine, but I just upgraded to R2019a, and the panels are hidden behind the uitabgroup, regardless of the order of uifigure.Children.
As a test, I added a new uipanel that partially obscures one of my previous uipanels, and proved to myself that flip(app.uifigure.Children) still works as expected to reorder the stack order of the components.
It seems to me like only the uitabgroup ignores the stacking order, where it previously worked.

Best Answer

I submitted a ticket to Mathworks and got a solution. This is a known bug that affects R2019a and was fixed in R2019b. As a workaround in R2019a, the following lines of code will fix the stacking order.
drawnow;
app.fig.Children = flip(app.fig.Children);
app.fig.Children = flip(app.fig.Children);