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] DataGrid turns blank by tabbing on bottom cells #14311

Closed
paulovila opened this issue Nov 6, 2023 · 9 comments · Fixed by unoplatform/Uno.WindowsCommunityToolkit#214
Closed
Assignees
Labels
area/focus Categorizes an issue as relevant to focus management area/windows-community-toolkit 🎚️ Categorizes an issue or PR as relevant to the Windows Community Toolkit difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/third-party 3️⃣ Categorizes an issue or PR as relevant to 3rd party libraries

Comments

@paulovila
Copy link

paulovila commented Nov 6, 2023

Current behavior

Given a Datagrid with rows (some of them not visible unless it is scrolled) .
Start editing a cell , press Tab key several times to focus on the next cell.
after the last visible row, it starts displaying a blank overlay, see video.

DataGridTabBlank.mp4

When focusing on the next cell which is a not visible column, it should scroll horizontally to display the cell . If the focusing column is wider than the Grid's width, the column should align to the very left of the DataGrid. If the focusing column is narrower than the DataGrid, then the very right of the column should be aligned to the very right of the DataGrid.
See video:

DataGridTabBlank2.mp4

Expected behavior

Changing focus on the DataGrid cells should behave similarly as WinUI

How to reproduce it

Source UnoApp6.zip

Works on UWP/WinUI

Yes

Affected platforms

WebAssembly

@paulovila paulovila 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 Nov 6, 2023
@MartinZikmund MartinZikmund added project/third-party 3️⃣ Categorizes an issue or PR as relevant to 3rd party libraries area/windows-community-toolkit 🎚️ Categorizes an issue or PR as relevant to the Windows Community Toolkit difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI area/focus Categorizes an issue as relevant to focus management 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 Nov 14, 2023
@Youssef1313 Youssef1313 self-assigned this Feb 15, 2024
@Youssef1313
Copy link
Member

This appears to be specific to Chromium.

@Youssef1313 Youssef1313 removed their assignment Feb 15, 2024
@cwhitlatch
Copy link

@Youssef1313 any work-around we can employ?

@darenm
Copy link
Contributor

darenm commented Mar 11, 2024

@jeromelaban Do we have any progress on workarounds we can try here?

@jeromelaban
Copy link
Member

@darenm we have not yet found any reliable workaround for this issue, we're continuing to look into it.

@Xiaoy312 Xiaoy312 self-assigned this Apr 9, 2024
@Xiaoy312

This comment was marked as outdated.

@darenm
Copy link
Contributor

darenm commented Apr 15, 2024

We shall take a look in our use-case and report back.

@Xiaoy312
Copy link
Contributor

Sorry for the incorrect information above. I rushed to conclusion.
The issue can still happen with the latest next/version, when Uno.Material is involved. Likely this is due to our handling of virtualization/scrolling with the significant difference of height between a normal cell and an edit-mode cell:

  • TextBlock at 17px [actually 32px from DataGridCell.MinHeight]; vs
  • TextBox at 58px.

You can workaround this issue, by either using the default fluent style or using an EditingElementStyle that is similar in size:

<tc:DataGrid ...>
	<tc:DataGrid.Resources>
		<!-- method1: force fluent style within the control -->
		<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />

	<tc:DataGrid.Columns>
		<tc:DataGridTextColumn ...>
			<tc:DataGridTextColumn.EditingElementStyle>
				<!-- method2: use an EditingElementStyle that results in a similar size than the ElementStyle -->
				<Style TargetType="TextBox">
					<Setter Property="MaxHeight" Value="32" />
					<!-- rest of the style... -->
				</Style>

As for the incorrect column snapping, I suspect it has the same root cause. One of the observation that I've made is that when the column has already expanded from entering edit-mode once, the snapping issue no longer occurs. The hypothesis here is that, on tab focusing change, we first perform a scroll-into-view with the column's normal width, and then resizing it for edit-mode... For this, the same fluent style trick will not work as they still have a width difference. But, you can workaround this by hardcoding a width for the column:

<tc:DataGridTextColumn Width="120" MaxWidth="120" ... />

@Xiaoy312
Copy link
Contributor

Xiaoy312 commented Apr 22, 2024

The blank/black bar at the bottom issue is fixed in #15354 which is available in Uno 5.2.
If you need the fix for an earlier version Uno, please let us know.


As for the column snapping issue, it a general problem with DataGrid, even on windows. We are working on a fix for this now.

@Xiaoy312
Copy link
Contributor

updated repro sample with other heads: u14311.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/focus Categorizes an issue as relevant to focus management area/windows-community-toolkit 🎚️ Categorizes an issue or PR as relevant to the Windows Community Toolkit difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI kind/bug Something isn't working project/third-party 3️⃣ Categorizes an issue or PR as relevant to 3rd party libraries
Projects
None yet
7 participants