Skip to content

Fix nested Text.rich semantics order#186116

Merged
auto-submit[bot] merged 4 commits into
flutter:masterfrom
gabrimatic:gabrimatic/nested-text-rich-semantics-order
May 14, 2026
Merged

Fix nested Text.rich semantics order#186116
auto-submit[bot] merged 4 commits into
flutter:masterfrom
gabrimatic:gabrimatic/nested-text-rich-semantics-order

Conversation

@gabrimatic
Copy link
Copy Markdown
Contributor

Fixes #176570

Nested Text.rich widgets can inherit placeholder semantics tags from ancestor paragraphs. When those inherited tags reuse the same placeholder index as the nested paragraph, RenderParagraph can merge all placeholder child semantics before the inline text segment.

This emits combined text semantics in span order and matches placeholder children against the direct placeholder tag so nested widget spans keep their accessibility label order.

Tests:

  • ../../bin/flutter test test/widgets/text_test.dart --plain-name='semantics label is in order with nested rich text widget spans'
  • ../../bin/flutter test test/widgets/text_test.dart
  • ../../bin/flutter analyze --no-pub lib/src/rendering/paragraph.dart test/widgets/text_test.dart

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. labels May 6, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the semantics configuration logic in RenderParagraph to process text information sequentially and introduces the _childConfigBelongsToPlaceholder helper method for tag validation. It also adds a test case for nested rich text semantics. Feedback suggests adding documentation to the new private method to align with the repository style guide.

Comment thread packages/flutter/lib/src/rendering/paragraph.dart
@Renzo-Olivares Renzo-Olivares self-requested a review May 9, 2026 01:21
Comment thread packages/flutter/test/widgets/text_test.dart
Comment thread packages/flutter/test/widgets/text_test.dart Outdated
Copy link
Copy Markdown
Contributor

@Renzo-Olivares Renzo-Olivares left a comment

Choose a reason for hiding this comment

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

LGTM, w some small comments.

@Renzo-Olivares Renzo-Olivares added the CICD Run CI/CD label May 13, 2026
Renzo-Olivares
Renzo-Olivares previously approved these changes May 13, 2026
@Renzo-Olivares Renzo-Olivares added the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label May 13, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label May 13, 2026
@gabrimatic gabrimatic requested a review from Renzo-Olivares May 13, 2026 08:33
@github-actions github-actions Bot removed the waiting for response The Flutter team cannot make further progress on this issue until the original reporter responds label May 13, 2026
Copy link
Copy Markdown
Contributor

@Renzo-Olivares Renzo-Olivares left a comment

Choose a reason for hiding this comment

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

LGTM, this will need a secondary reviewer before landing. Thank you for the contribution!

@Renzo-Olivares Renzo-Olivares requested a review from chunhtai May 13, 2026 18:59
@gabrimatic gabrimatic requested a review from Renzo-Olivares May 13, 2026 19:00
Copy link
Copy Markdown
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

@chunhtai chunhtai added autosubmit Merge PR when tree becomes green via auto submit App CICD Run CI/CD labels May 13, 2026
@auto-submit
Copy link
Copy Markdown
Contributor

auto-submit Bot commented May 13, 2026

autosubmit label was removed for flutter/flutter/186116, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 13, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label May 13, 2026
@chunhtai chunhtai added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels May 13, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue May 14, 2026
Merged via the queue into flutter:master with commit 987d8c5 May 14, 2026
90 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 14, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request May 15, 2026
flutter/flutter@0541913...1ceffd1

2026-05-14 ikramhasan.dev@gmail.com Fix selection highlight artifacts for faded selectable text (flutter/flutter#183628)
2026-05-14 46920873+gabrimatic@users.noreply.github.com Fix nested Text.rich semantics order (flutter/flutter#186116)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC bmparr@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems CICD Run CI/CD framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong semantics order in nested Text.rich

3 participants