[FluentNotification] Add Expand button behavior#2260
Open
nodes11 wants to merge 5 commits intomicrosoft:mainfrom
Open
[FluentNotification] Add Expand button behavior#2260nodes11 wants to merge 5 commits intomicrosoft:mainfrom
nodes11 wants to merge 5 commits intomicrosoft:mainfrom
Conversation
joannaquu
reviewed
Apr 1, 2026
| message: hasMessage ? message : nil, | ||
| attributedMessage: hasAttribute && hasMessage ? attributedMessage : nil, | ||
| messageLineLimit: messageLineLimit, | ||
| enableExandableMessageText: expandButtonMode == 1, |
Contributor
There was a problem hiding this comment.
nit: enableExpandableMessageText
joannaquu
reviewed
Apr 1, 2026
joannaquu
reviewed
Apr 1, 2026
| /// Action to be dispatched by the dismiss button on the trailing edge of the control. | ||
| var defaultDismissButtonAction: (() -> Void)? { get set } | ||
|
|
||
| /// If dismiss button should be replaced an expand button |
joannaquu
reviewed
Apr 1, 2026
| /// - isFlexibleWidthToast: Whether the width of the toast is set based on the width of the screen or on its contents. | ||
| /// - message: Optional text for the main title area of the control. If there is a title, the message becomes subtext. | ||
| /// - attributedMessage: Optional attributed text for the main title area of the control. If there is a title, the message becomes subtext. If set, it will override the message parameter. | ||
| /// - messageLineLimit: The maximum number of lines the message can show. Any exess text is truncated. |
joannaquu
reviewed
Apr 1, 2026
| /// - message: Optional text for the main title area of the control. If there is a title, the message becomes subtext. | ||
| /// - attributedMessage: Optional attributed text for the main title area of the control. If there is a title, the message becomes subtext. If set, it will override the message parameter. | ||
| /// - messageLineLimit: The maximum number of lines the message can show. Any exess text is truncated. | ||
| /// - enableExandableMessageText: If enabled, a expand button will be shown in place of the dimiss icon when the text is truncted. Tapping the expand button will display all lines of text. |
joannaquu
reviewed
Apr 1, 2026
| titleLabel | ||
| } | ||
| messageLabel.lineLimit(state.messageLineLimit > 0 ? state.messageLineLimit : nil) | ||
| if hasSecondTextRow { |
Contributor
There was a problem hiding this comment.
nit: I can't see the whitespace difference here but could we double check
joannaquu
approved these changes
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Platforms Impacted
Description of changes
This change introduces two new features for the
FluentNotification, both of which revolve around an "Expand" button.In the first use case, the expand button allows a text label to be fully visible if it is truncated. This is achieved through the addition of a new SwiftUI view called
ExpandableText. Consumers can enable this feature by settingenableExpandableMessageTexttotrueon theFluentNotificationor the corresponding state object (depending on the initialization method).The second use case exposes the expand button and a custom action block that a client can provide. This can be enabled by setting
showExpandButtonInPlaceOfDismissButtontotrueand providing a non-nilexpandButtonAction.The current flaw with this change is that there are 2 separate feature toggles that control the same button. The user could encounter undefined behavior if both were enabled at the same time. I am considering other ways to expose the custom expand action behavior such as through a swipe gesture or tapping the notification view body.
Binary change
(how is our binary size impacted -- see https://github.com/microsoft/fluentui-apple/wiki/Size-Comparison)
Verification
Validated in the fluent demo controller, as well as in internal use cases.
Visual Verification
ExpandableText Demo:
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-03-31.at.16.11.53.mov
Expand Button Custom Action:
Simulator.Screen.Recording.-.iPhone.17.Pro.-.2026-03-31.at.16.12.12.mov
Pull request checklist
This PR has considered:
Microsoft Reviewers: Open in CodeFlow