fix(mobile): keep token labels visible in authored Markdown links - #7545
Open
masfour7 wants to merge 1 commit into
Open
fix(mobile): keep token labels visible in authored Markdown links#7545masfour7 wants to merge 1 commit into
masfour7 wants to merge 1 commit into
Conversation
🔐 Codex Security Review
|
gpt_markdown renders a link's label by recursing with `MarkdownScope.linkLabel`. `_ChannelLinkMd`, `_MentionMd` and `CustomEmojiMd` inherited the default `scopes => allScopes`, so they claimed labels such as `block#2959`, `@Alice` and `:wave:` and returned a `WidgetSpan`. That span landed inside the link's own `WidgetSpan`, and a placeholder nested in a placeholder does not paint on iOS — the label, underline and tap target all disappeared. Opt all three components out of the link-label scope. Tokens outside a link label keep their pills. Also widen four `message_content_test.dart` helpers from `find.byType(RichText)` to a subclass-aware predicate. Body paragraphs render through `BidiRichText` since gpt_markdown 1.2.1, so those helpers no longer saw them and a regression test built on top of them would not have bound to the rendered output. Fixes block#6124 Co-authored-by: Samin Yeasar Sohag <sssohag172@gmail.com> Signed-off-by: Samin Yeasar Sohag <sssohag172@gmail.com> Signed-off-by: Mohammad Asfour <mya26@cornell.edu>
masfour7
force-pushed
the
fix/mobile-link-label-scopes
branch
from
September 9, 2026 22:10
73bcafb to
1ec6c4d
Compare
wesbillman
approved these changes
Sep 9, 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.
Summary
On iOS, an authored Markdown link renders as blank when its label is recognized as a Buzz channel, mention, or custom emoji. For example:
The surrounding text remains visible, but the link has no visible label or tap target.
Buzz's
_ChannelLinkMd,_MentionMd, andCustomEmojiMdcomponents returnWidgetSpans.gpt_markdownalso renders an authored link through aWidgetSpanand reparses its label through the registered components. Because the Buzz components were allowed to run inside link labels, the result was a placeholder nested inside another placeholder, which does not paint on iOS.This PR adds the same scope restriction used by
gpt_markdown's built-in link component:The override is applied to all three widget-based components. Authored labels such as
[#2959](url),[@Alice](url), and[:wave:](url)therefore remain ordinary link text, while the same tokens outside links continue rendering as Buzz pills and custom emoji.The PR also updates the shared test helpers to find
RichTextsubclasses. Since the upgrade togpt_markdown1.2.1, body paragraphs can render throughBidiRichText;find.byType(RichText)does not match that subclass and could allow an absence assertion to pass without inspecting the message text.The handling of unknown bare
#tokensis deliberately unchanged. Whether those should remain non-interactive pills or become plain text is a separate product decision.Related issue
Fixes #6124.
This supersedes #6135. That PR solves the same issue by maintaining a custom fork of
gpt_markdown's link component; this PR instead uses the scoped-component API already available ingpt_markdown1.2.1.Testing
Focused suites:
flutter test \ test/features/channels/message_content_test.dart \ test/features/channels/message_content_custom_emoji_test.dartResult: 95 tests passed, 0 failed.
Additional checks:
just mobile-check— passed; analyzer reported no issues.just mobile-fmt— passed; 549 files formatted with 0 changes._ChannelLinkMdoverride causes two regression tests to fail; removing_MentionMdorCustomEmojiMdcauses one test to fail in each case.message_content_test.dartdirectly assert that the nested-placeholder structure is absent. The custom-emoji tests separately verify literal text and the absence or presence ofCustomEmojiImage, depending on whether the shortcode is inside or outside a link.The complete local mobile suite reports 15 failures that reproduce identically on a clean checkout of
mainat44316ff7. In CI for that same commit,Clients / Mobile,Mobile, andMobile Swift Domain / Mobile Swiftall passed.No native-device screenshot is included. The nested-placeholder fix was verified through the rendered widget structure, but an iOS simulator build was blocked by the existing
MLImage.frameworkarm64-simulator incompatibility.