microsoft / microsoft/microsoft-ui-xaml

InlineUIContainers appear in the middle of RichTextBlock if trimmed out with text wrapping disabled

Open
#10,627 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area-TextBox bug
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

Describe the bug

In my app I use InlineUIContainer to display custom emojis in messages.
There are so far no issues when the full message text is displayed, but in some places we need to display it in a single line (replies, chat list...) and there InlineUIContainer elements start to appear in the wrong position.
This only seems to happen when TextWrapping is set to NoWrap. There's a workaround is to leave wrapping enabled and set MaxLines to an appropriate value (that introduces some other issues, by example in the video I use a single RichTextBlock with separate Paragraphs for author name and actual text).

Another issue I encountered in the same scenario is that if the Paragraph begins with an InlineUIContainer the text may trim automatically right after it.

Both issues exist since UWP.

Steps to reproduce the bug
  1. Create a new RichTextBlock with TextWrapping = NoWrap and TextTrimming = CharacterEllipsis.
  2. Add a Run with some text long enough to get trimmed, followed by a InlineUIContainer.
  3. Notice the InlineUIContainer appear on top of text instead of being hidden.
Expected behavior

No response

Screenshots

https://github.com/user-attachments/assets/f0e6aa50-eab8-4ead-a6ed-7535ca44582c

NuGet package version

None

Windows version

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the RichTextBlock reproduction using TextWrapping=NoWrap, TextTrimming=CharacterEllipsis, a long Run, and a following InlineUIContainer. Verify behavior when an InlineUIContainer begins a Paragraph as well. Done means trimmed containers no longer appear over text and leading containers do not cause premature trimming.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.