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] Element with bottom or right margin in ScrollViewer cannot be scrolled to the end #7000

Open
dr1rrb opened this issue Sep 8, 2021 · 5 comments
Assignees
Labels
area/scrollviewer ⏬ Categorizes an issue or PR as relevant to ScrollViewer 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/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..)

Comments

@dr1rrb
Copy link
Member

dr1rrb commented Sep 8, 2021

Current behavior

If you put an element with a bottom or right margin as Content of a ScrollViewer, then the element won't be fully scrollable.

Expected behavior

🙃

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

<ScrollViewer Width="1024" Height="1024">
	<Border Width="2048" Height="2048" Margin="50, 256" BorderBrush="Red" BorderThickness="5"/>
</ScrollViewer>

We cannot see the bottom and right borders.

Workaround

Surround the element with a Border without margin:

<ScrollViewer Width="1024" Height="1024">
	<Border>
		<Border Width="2048" Height="2048" Margin="50, 256" BorderBrush="Red" BorderThickness="5"/>
	</Border>
</ScrollViewer>

Works on UWP/WinUI

Yes

Environment

Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia

NuGet package version(s)

3.10.0-dev.632

Affected platforms

WebAssembly Skia (WPF), Skia (GTK on Linux/macOS/Windows), Skia (Tizen)

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

Most probably also affects macOS

Work on Android

Not validated on iOS

@dr1rrb dr1rrb added kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Sep 8, 2021
@jeromelaban jeromelaban added project/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..) and removed triage/untriaged Indicates an issue requires triaging or verification labels Sep 9, 2021
mikebmcl added a commit to mikebmcl/uno that referenced this issue Jan 8, 2022
…by putting the Content in an empty Border that serves as a wrapper. ScrollContentPresenter.ArrangeOverride has been updated to check for this workaround and test for a custom ViewPort accordingly.
mikebmcl added a commit to mikebmcl/uno that referenced this issue Jan 11, 2022
…by putting the Content in an empty Border that serves as a wrapper. ScrollContentPresenter.ArrangeOverride has been updated to check for this workaround and test for a custom ViewPort accordingly.
mikebmcl added a commit to mikebmcl/uno that referenced this issue Jan 14, 2022
…by putting the Content in an empty Border that serves as a wrapper. ScrollContentPresenter.ArrangeOverride has been updated to check for this workaround and test for a custom ViewPort accordingly.
@dr1rrb dr1rrb self-assigned this Jan 28, 2022
@agneszitte agneszitte self-assigned this Feb 8, 2022
@hawkerm
Copy link

hawkerm commented Feb 21, 2022

Yeah, just ran into this as well on WASM, think it's the same as #6443. It can be reproduced in the Uno Playground Textblock example too. Just add Margin="0,0,0,512" to the StackPanel at the top.

I can confirm the same workaround of putting a blank border around the StackPanel in the Uno Playground also shows the correct expected behavior.

@dr1rrb
Copy link
Member Author

dr1rrb commented Mar 1, 2022

Investigated the issue today with @agneszitte-nventive ... this is actually an expected behavior of browser: neither the padding of the scrolling parent element nor margin of the child is taken in consideration by the browser when it computes extents (https://stackoverflow.com/questions/11695354/css-right-margin-does-not-work-inside-a-div-with-overflow-scroll).

To fix this issue we do have to insert a wrapping element.

This could be a "managed element" injected dynamically by the SV like the NativeScrollContentPresenter on iOS and Android. It would then require to re-route a lot of properties computed in the SV.UpdateDimensions method (like on iOS and Android).

Another solution would be to inject a "DOM only" div which act as a wrapper on which we would have to set the Extent<Width|Height> as <Width|Height>. This might cause also some issue when we are enumerating the DOM (e.g. here) as we are most probably always assuming that we have only one HTMLElement for one UIElement.

Note: This bug will be fixed by #8210 for top and left margin. The issue remain valid only for right and bottom margins on WASM! For those cases, the workaround remains valid.

Stack Overflow
I am trying to make two divs, one inside the other. The inner div is larger than the outer div, the outer div has overflow:scroll, and the inner div has margin:25px. So I do this:

#outer {
wid...

@dr1rrb dr1rrb changed the title Element with margin in ScrollViewer cannot be scrolled to the end [WASM] Element with bottom or right margin in ScrollViewer cannot be scrolled to the end Mar 1, 2022
agneszitte pushed a commit that referenced this issue Mar 2, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
@agneszitte
Copy link
Contributor

agneszitte commented Mar 2, 2022

#8210 related PR in order for the content margin to be taken into consideration for Skia entirely and top|left margin for WASM.

(Note for WASM: bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed for this issue. Referring to @dr1rrb details above. You can use the easy workaround of surrounding the element with a Border without margin inside the SrollViewer until then.)

agneszitte pushed a commit that referenced this issue Mar 2, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 2, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 3, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 7, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 7, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 17, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 18, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 18, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 24, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 24, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 24, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 25, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 25, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 25, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Mar 25, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
agneszitte pushed a commit that referenced this issue Apr 1, 2022
…r Skia and WASM.

(Note for WASM; bottom or right margin in ScrollViewer cannot be scrolled to the end still need to be fixed with issue #7000)
@agneszitte
Copy link
Contributor

Note for contributors

These changes will need to be updated when this bottom/right margin issue is fixed for WASM (comments with details left in the code).

(cc @jeromelaban / @dr1rrb )

@agneszitte agneszitte removed their assignment Apr 4, 2022
@MartinZikmund MartinZikmund added area/scrollviewer ⏬ Categorizes an issue or PR as relevant to ScrollViewer difficulty/medium 🤔 Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI and removed difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. labels Jul 14, 2023
@MartinZikmund MartinZikmund changed the title [WASM] Element with bottom or right margin in ScrollViewer cannot be scrolled to the end [WASM] Element with bottom or right margin in ScrollViewer cannot be scrolled to the end Jul 14, 2023
@MartinZikmund MartinZikmund added the platform/wasm 🌐 Categorizes an issue or PR as relevant to the WebAssembly platform label Jul 14, 2023
@MartinZikmund
Copy link
Member

Simple repro for this - http://playground.platform.uno/#88b23fc2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/scrollviewer ⏬ Categorizes an issue or PR as relevant to ScrollViewer 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/layout 🧱 Categorizes an issue or PR as relevant to layouting and containers (Measure/Arrange, Collections,..)
Projects
None yet
Development

No branches or pull requests

5 participants