Skip to content

Uno WASM: Horizontal scrollbar is not displayed when there is no vertical overflow #421

Description

@luckypong

Description:

On Uno Platform WASM, the horizontal scrollbar of WinUI.TableView is not displayed when the content exceeds the horizontal viewport but does not exceed the vertical viewport.

The horizontal scrollable area is correctly calculated (ScrollableWidth > 0), and the horizontal ScrollBar is created and measured correctly. However, its IndicatorMode remains None, causing the scrollbar thumb to have an opacity of 0 and remain invisible.

Interestingly, when a vertical scrollbar becomes visible, the horizontal scrollbar starts working correctly as well.

As a workaround, I found that temporarily forcing the VerticalScrollBarVisibility to Visible, invalidating the layout, and then restoring the original VerticalScrollBarVisibility and VerticalScrollMode followed by another invalidation causes the horizontal scrollbar to be displayed correctly.

In non-Windows apps, scrolling is only possible in empty spaces. Also, the header does not work when scrolling.

Steps to Reproduce:

  1. Use WinUI.TableView v1.4.1 on Uno Platform WASM.
  2. Configure the TableView with:
    • Horizontal stretching.
    • A fixed vertical height.
    • Multiple fixed-width columns whose total width exceeds the available viewport width.
  3. Load only a small number of rows so that the content does not require a vertical scrollbar.
  4. Observe the horizontal scrollbar.

The horizontal scrollbar is not displayed.

For example, the ScrollViewer reports values similar to:

ViewportWidth    = 1470.66
ExtentWidth      = 1524.66
ScrollableWidth  = 54
ComputedHScroll  = Visible

Expected behavior:

The horizontal scrollbar should be displayed and usable whenever:

ExtentWidth > ViewportWidth

regardless of whether a vertical scrollbar is required.

A vertical overflow should not be necessary for the horizontal scrollbar to become active.

Workaround:

A workaround is currently being used by temporarily forcing the vertical scrollbar to be visible, invalidating the layout, and then restoring the original vertical scrollbar mode and visibility and invalidating the layout again.

var originalVerticalMode = scrollViewer.VerticalScrollMode;
var originalVerticalVisibility = scrollViewer.VerticalScrollBarVisibility;

// Force vertical scrollbar state
scrollViewer.VerticalScrollMode = ScrollMode.Enabled;
scrollViewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;

scrollViewer.InvalidateMeasure();
scrollViewer.InvalidateArrange();
scrollViewer.UpdateLayout();

// Restore original state
scrollViewer.VerticalScrollMode = originalVerticalMode;
scrollViewer.VerticalScrollBarVisibility = originalVerticalVisibility;

scrollViewer.InvalidateMeasure();
scrollViewer.InvalidateArrange();
scrollViewer.UpdateLayout();

I was unable to confirm whether the issue was with Uno or TableView, and since the Uno SDK does not yet support 1.8, I am solving it using workaround code based on 1.4.1.

Screenshots:

If applicable, add screenshots to help explain your problem.

Environment:

  • Package Version: 1.4.1
  • WinAppSDK Version: 1.7.x
  • Uno Platform Version: 6.6.42
  • Platform: WASM

Contribution:

  • I am willing to submit a PR to fix this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions