Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WASM] TextBlock text selection using double-click bleeds into other controls #13440

Open
brookslindseyjr opened this issue Aug 29, 2023 · 3 comments
Labels
area/textblock Categorizes an issue or PR as relevant to the TextBlock control difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform project/text 🔤 Categorizes an issue or PR as relevant to text (TextBox, PasswordBox, TextBlock, Fonts, …)

Comments

@brookslindseyjr
Copy link

Current behavior

When selecting text via double-click, the selection highlight is also selecting adjacent text controls. This works on WinUI Desktop but not WASM. The behavior also seems different across different browsers. Firefox does not have this problem, but Edge and Chrome do.

Expected behavior

Double-clicking on a TextBlock should only select that text.

How to reproduce it (as minimally and precisely as possible)

Drop this on a page and double-click on one of the TextBlocks:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="200"/>
        <ColumnDefinition Width="200"/>
    </Grid.ColumnDefinitions>
    <TextBlock IsTextSelectionEnabled="True"
               Text="Word"
               Grid.Row="0"
               Grid.Column="0"/>
    <TextBlock IsTextSelectionEnabled="True"
               Text="Word"
               Grid.Row="0"
               Grid.Column="1"/>
    <TextBlock IsTextSelectionEnabled="True"
               Text="Word"
               Grid.Row="1"
               Grid.Column="0"/>
    <TextBlock IsTextSelectionEnabled="True"
               Text="Word"
               Grid.Row="1"
               Grid.Column="1"/>
</Grid>

Workaround

No response

Works on UWP/WinUI

Yes

Environment

Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia

NuGet package version(s)

image

Affected platforms

WebAssembly

IDE

Visual Studio 2022

IDE version

17.6.5

Relevant plugins

No response

Anything else we need to know?

No response

@brookslindseyjr brookslindseyjr added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Aug 29, 2023
@Youssef1313 Youssef1313 added platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform area/textblock Categorizes an issue or PR as relevant to the TextBlock control project/text 🔤 Categorizes an issue or PR as relevant to text (TextBox, PasswordBox, TextBlock, Fonts, …) labels Aug 29, 2023
@jeromelaban
Copy link
Member

@brookslindseyjr could you provide a screenshot of what you're observing, in case, there's variability in the result. Thanks!

@ChaseKopp6
Copy link

this issue is still active but depends on where you double click, sometimes works correctly sometimes not

ex:

Image

@MartinZikmund MartinZikmund changed the title [WASM] TextBlock text selection using double-click bleeds into other controls [WASM] TextBlock text selection using double-click bleeds into other controls Oct 23, 2023
@MartinZikmund MartinZikmund added difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI and removed triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Oct 23, 2023
@ramezgerges
Copy link
Contributor

The produced html from the provided sample is similar (after a lot of simplification) to

<div style="position: absolute;">
  <p style="position: absolute; top: 0px; left: 0px;">Word</p>
  <p style="position: absolute; top: 0px; left: 200px;">Word</p>
  <p style="position: absolute; top: 19px; left: 0px;">Word</p>
  <p style="position: absolute; top: 19px; left: 200px;">Word</p>
</div>

This is a problem with divs and text. Double clicking a div will select whatever is inside it. That's why all the ps are selected. One could tamper with the user-select css property to disable text-selection altogether, or achieve various levels of similarity (e.g. https://jsfiddle.net/qcewyujb/), but there doesn't seem to be an obvious way to just make it work as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/textblock Categorizes an issue or PR as relevant to the TextBlock control difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform project/text 🔤 Categorizes an issue or PR as relevant to text (TextBox, PasswordBox, TextBlock, Fonts, …)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants