Skip to content

Fix SafeAreaEdges comments and access modifiers#34397

Merged
jfversluis merged 1 commit into
dotnet:net11.0from
jeremy-visionaid:fix-layout-default-safe-area-comment
May 1, 2026
Merged

Fix SafeAreaEdges comments and access modifiers#34397
jfversluis merged 1 commit into
dotnet:net11.0from
jeremy-visionaid:fix-layout-default-safe-area-comment

Conversation

@jeremy-visionaid

Copy link
Copy Markdown
Contributor

Layout.SafeAreaEdges documents the default value to be "None", but the default value delegate actually returns "Container".

@github-actions

github-actions Bot commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34397

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34397"

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Mar 10, 2026
@jeremy-visionaid jeremy-visionaid marked this pull request as draft March 10, 2026 06:45
@jeremy-visionaid jeremy-visionaid force-pushed the fix-layout-default-safe-area-comment branch from ba0c5f0 to 83ed49b Compare March 10, 2026 07:34
@jeremy-visionaid jeremy-visionaid changed the title Fix Layout default SafeAreaEdges comment Fix default SafeAreaEdges comments Mar 10, 2026
@jeremy-visionaid jeremy-visionaid marked this pull request as ready for review March 10, 2026 07:36
@sheiksyedm sheiksyedm added the area-docs Conceptual docs, API docs, Samples label Mar 10, 2026
@jfversluis jfversluis requested a review from Copilot March 17, 2026 08:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates XML documentation for SafeAreaEdges defaults across several Controls types to better reflect current safe-area behavior and to standardize wording.

Changes:

  • Adjusts documented default safe-area behavior for Layout, ContentView, ContentPage, and Border.
  • Standardizes “edge-to-edge” wording in the ScrollView safe area docs.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Controls/src/Core/ScrollView/ScrollView.cs Doc wording tweak for the SafeAreaEdges default description.
src/Controls/src/Core/Layout/Layout.cs Updates documented default SafeAreaEdges value for Layout.
src/Controls/src/Core/ContentView/ContentView.cs Updates documented default SafeAreaEdges value for ContentView.
src/Controls/src/Core/ContentPage/ContentPage.cs Updates documented default SafeAreaEdges value for ContentPage.
src/Controls/src/Core/Border/Border.cs Updates documented default SafeAreaEdges value for Border.
Comments suppressed due to low confidence (2)

src/Controls/src/Core/ContentView/ContentView.cs:42

  • The remarks for SafeAreaEdges refer to SafeAreaRegions.Keyboard, but SafeAreaRegions does not define Keyboard (it uses SoftInput). Please update the remarks to use the correct enum value name (and ensure the guidance matches the actual values supported by SafeAreaRegions).
		/// The default value is SafeAreaEdges.None (edge-to-edge).
		/// </summary>
		/// <remarks>
		/// This property controls which edges of the content view should obey safe area insets.
		/// Use SafeAreaRegions.None for edge-to-edge content, SafeAreaRegions.All to obey all safe area insets, 

src/Controls/src/Core/Border/Border.cs:70

  • The remarks for SafeAreaEdges mention SafeAreaRegions.Keyboard, but SafeAreaRegions doesn't have a Keyboard value (it uses SoftInput). Please update the remarks to use the correct enum value name so consumers aren't pointed at a non-existent option.
		/// The default value is SafeAreaEdges.None (edge-to-edge).
		/// </summary>
		/// <remarks>
		/// This property controls which edges of the border should obey safe area insets.
		/// Use SafeAreaRegions.None for edge-to-edge content, SafeAreaRegions.All to obey all safe area insets, 

You can also share your feedback on Copilot code review. Take the survey.

/// <summary>
/// Gets or sets the safe area edges to obey for this scroll view.
/// The default value is SafeAreaEdges.Default (None - edge to edge).
/// The default value is SafeAreaEdges.Default (None - edge-to-edge).
Comment thread src/Controls/src/Core/Layout/Layout.cs
@jfversluis

Copy link
Copy Markdown
Member

@jeremy-visionaid I see Copilot has some minor comments. Can you please double-check and let me know? :)

@PureWeen PureWeen added this to the .NET 10 SR6 milestone Mar 17, 2026
@PureWeen PureWeen moved this to Changes Requested in MAUI SDK Ongoing Mar 17, 2026
@jeremy-visionaid

Copy link
Copy Markdown
Contributor Author

@jfversluis This maybe opens up a can of worms... 😅

I'd probably accept Copilot's first suggestion - even though it was the thing that wrote it in the first place. ScrollView behavior is special, so it doesn't map cleanly to the abstracted values.

It's not wrong about the internal reference, but it also implemented that incorrectly too. e.g.

	/// <summary>
	/// A <see cref="SafeAreaEdges"/> with all edges set to <see cref="SafeAreaRegions.All"/>.
	/// </summary>
	internal static SafeAreaEdges Container { get; } = new(SafeAreaRegions.Container);

The comment is incorrect, and it's internal, when it should probably be public. It is the value that's actually used as a default (you can only create an equivalent struct and not use that member directly). It is referenced from the MAUI docs (which also incorrectly refer to it as an enum):
https://learn.microsoft.com/en-us/dotnet/maui/user-interface/safe-area?view=net-maui-10.0#safeareaedges-enum

For the scope of this PR, I was only intending to address the thing that caught me and another team member out - the behavior of the controls wasn't what we expected since IntelliSense told us the wrong defaults. There's prob more AI slop that needs fixing after this - there was a bunch of stuff that looked off to me but I didn't know where I should stop 🤷 I think it's reasonable to fix up the SafeAreaEdges.Container bit here too, but it does affect the public API...

@jeremy-visionaid

Copy link
Copy Markdown
Contributor Author

@kubaflo I've changed it to satisfy Copilot, and added a few other bits that it missed. Unfortunately, the comments also reference members that appear to be unintentionally internal, so it also needs an update to the public API...

@kubaflo

kubaflo commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

@PureWeen what do you think?

@jeremy-visionaid jeremy-visionaid changed the title Fix default SafeAreaEdges comments Fix SafeAreaEdges comments and access modifiers Apr 29, 2026

@PureWeen PureWeen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retarget to net11.0

Otherwise looks good

@MauiBot

MauiBot commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Merge Conflict Detected — This PR has merge conflicts with its target branch. Please rebase onto the target branch and resolve the conflicts.

kubaflo
kubaflo previously approved these changes May 1, 2026
@kubaflo kubaflo enabled auto-merge (squash) May 1, 2026 09:08
@kubaflo

kubaflo commented May 1, 2026

Copy link
Copy Markdown
Contributor

@jfversluis we can merge this to net11

@kubaflo kubaflo changed the base branch from main to net11.0 May 1, 2026 09:08
@kubaflo kubaflo dismissed their stale review May 1, 2026 09:08

The base branch was changed.

Default SafeAreaEdges values are set by a delegate, so
SafeAreaEdges.Default is not used in most cases.

Also make SafeAreaEdges.Container public as it is referenced in the API
documentation.
@kubaflo kubaflo force-pushed the fix-layout-default-safe-area-comment branch from c202daf to 7f5addc Compare May 1, 2026 09:14
@jfversluis jfversluis disabled auto-merge May 1, 2026 11:26
@jfversluis jfversluis merged commit 5713f9e into dotnet:net11.0 May 1, 2026
36 checks passed
@github-project-automation github-project-automation Bot moved this from Changes Requested to Done in MAUI SDK Ongoing May 1, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

🚨 API change(s) detected @davidbritch FYI

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

🚨 API change(s) detected @davidortinau FYI

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-docs Conceptual docs, API docs, Samples community ✨ Community Contribution s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) t/breaking 💥

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants