TabView Alignment Issue Inside a Popover on iPadOS

I've encountered an issue when using TabView inside a Popover on iPadOS, and I wanted to see if anyone else has run into this or if there's a known workaround before I file a bug report.

Issue:

When placing a TabView inside a Popover on iPadOS, the tab bar is not center-aligned correctly if the popover’s arrow appears on either the leading or trailing edge. It seems that the centering calculation for the TabView includes the width of the arrow itself.

If the popover arrow is on the left, the tabs inside the TabView are pushed to the left. If the popover arrow is on the right, the tabs shift toward the right. This suggests that SwiftUI is incorporating the popover arrow’s width into the alignment calculation, which results in the misalignment.

Questions:

  • Has anyone else encountered this behavior?
  • Is there a known workaround to ensure proper centering?
  • If this is indeed a bug, should I file a report through Feedback Assistant?

Any insights would be greatly appreciated!

Answered by DTS Engineer in 831422022

TabViews are not designed to be enclosed in a popover. Popovers are meant for small amount of information or functionality. Please review Popovers and Tab views in the HIG for best practices.

Accepted Answer

TabViews are not designed to be enclosed in a popover. Popovers are meant for small amount of information or functionality. Please review Popovers and Tab views in the HIG for best practices.

TabView Alignment Issue Inside a Popover on iPadOS
 
 
Q