Skip to content

Align button areas to consistent width across SegmentedRowView rows#1208

Open
timbms wants to merge 1 commit into
developfrom
feature/segmented-row-consistent-button-width
Open

Align button areas to consistent width across SegmentedRowView rows#1208
timbms wants to merge 1 commit into
developfrom
feature/segmented-row-consistent-button-width

Conversation

@timbms

@timbms timbms commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Segmented, press-release and single-mapping button areas on the same page previously had different widths, making the list look ragged
  • Introduces SegmentedButtonAreaWidthKey (PreferenceKey, max-reduce) and segmentedButtonAreaMaxWidth (@Entry environment value) to propagate the page-wide maximum button-area width
  • alignSegmentedButtonAreas() on the List in SitemapPageView (and PreviewList) wires onPreferenceChangeenvironment
  • buttonAreaWidth() on each button-area type measures natural width via a GeometryReader background and applies an exact frame(width: maxWidth, alignment: .trailing) once the page-wide max is known — all three button types (segmented, press-release, single-mapping) share the same frame width and stay trailing-aligned within it

Test plan

  • Open a sitemap page with a mix of segmented, press-release and single-mapping rows — verify all button areas are the same width and flush with the trailing edge
  • Verify the selection indicator animation and optimistic selection still work correctly on segmented rows
  • Verify press-and-hold behaviour on press-release buttons is unaffected
  • Verify single-mapping button tap behaviour is unaffected
  • Check layout on pages that contain only one segmented row (no alignment effect expected)
  • Check layout with very long labels to confirm the button area does not overflow its row insets

Segmented, press-release and single-mapping button areas on the same
page previously had different widths depending on label content.
Introduce a PreferenceKey/EnvironmentKey pair so each page collects the
maximum natural button-area width and feeds it back to every row via
`alignSegmentedButtonAreas()` on the List. Each button area reports its
natural width and is then sized to the page-wide maximum using an exact
frame, keeping all controls trailing-aligned and within row bounds.

Signed-off-by: Tim Mueller-Seydlitz <timbms@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant