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

WebView within TabbedPage on Android has weird scrolling interactions #6487

Open
SteveSandersonMS opened this issue Apr 25, 2022 · 10 comments
Open
Assignees
Labels
area-controls-webview WebView p/2 Work that is important, but is currently not scheduled for release platform/android 🤖 t/bug Something isn't working
Milestone

Comments

@SteveSandersonMS
Copy link
Member

Description

If you put a WebView (for example BlazorWebView, but it doesn't have to be Blazor) inside a TabbedPage, and the content within the webview has horizontal scrolling, then trying to scroll the web content horizontally will cause the enclosing TabbedPage to scroll and switch to the previous/next tab.

This basically means you can't have this combination of controls as the UX is broken. On other platforms this problem doesn't occur because other platforms don't use swipe left/right to switch tabs.

Expected behavior: If the touch interaction starts within the webview, it should not scroll the enclosing TabbedPage.

Steps to Reproduce

Create MAUI app. Add TabbedPage with multiple tabs. Add WebView inside one of the tabs. Get the webview to show some web content like:

<div style="overflow-x: scroll">
    <div style="width: 3000px">Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello Hello </div>
</div>

... then run the app on Android and try to scroll that content.

Version with bug

Release Candidate 1 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

All

Did you find any workaround?

No response

Relevant log output

No response

@SteveSandersonMS SteveSandersonMS added t/bug Something isn't working s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Apr 25, 2022
@SteveSandersonMS
Copy link
Member Author

Also, probably a bigger problem is that this also affects more common vertical-scrolling web content when inside a TabbedPage on Android.

If you do a big swipe to try to scroll a long vertical distance, unless you manage to do a very exact vertical line with your finger, you'll accidentally trigger the horizontal scrolling behavior of the enclosing TabbedPage which is quite frustrating.

@jfversluis jfversluis added platform/android 🤖 legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor area-controls-webview WebView and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Apr 26, 2022
@VincentBu VincentBu added the s/triaged Issue has been reviewed label Apr 26, 2022
@Redth
Copy link
Member

Redth commented Apr 26, 2022

@PureWeen is there an API already to disable the swipe tab change on android? perhaps that would help?

@Redth Redth added this to the 6.0.300 milestone Apr 26, 2022
@PureWeen
Copy link
Member

@Redth We have a platform specific for android so you can enable/disable it which should start working once we merge this PR
#5831

Though we might want to look at making some smart choice here :-)
If the tab has a WebVIew then we just disable it unless the user has specifically enabled it

@SteveSandersonMS
Copy link
Member Author

I’m not a regular Android user so I might be missing the conventions, but I would have thought the tab scroll behaviour should be suppressed only when the individual touch interaction starts within a webview. A tab might contain many things, only one of which might be a small webview.

However if that’s technically impractical then I recognise that the heuristic proposed above is better than the existing behaviour.

@PureWeen
Copy link
Member

PureWeen commented Apr 26, 2022

I’m not a regular Android user so I might be missing the conventions, but I would have thought the tab scroll behaviour should be suppressed only when the individual touch interaction starts within a webview. A tab might contain many things, only one of which might be a small webview.

However if that’s technically impractical then I recognise that the heuristic proposed above is better than the existing behaviour.

Agreed. We'll also want to make sure whatever we do here doesn't interfere with accessibility expectations.

@VincentBu VincentBu removed the s/triaged Issue has been reviewed label Apr 27, 2022
@davidortinau davidortinau added the p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint label May 1, 2022
@PureWeen
Copy link
Member

PureWeen commented May 3, 2022

Most likely fix for this

@Redth Redth added p/2 Work that is important, but is currently not scheduled for release and removed p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint labels May 3, 2022
@VincentBu
Copy link

still repros with vs main build, here is an example:
MauiApp6487.zip

@VincentBu VincentBu added the s/verified Verified / Reproducible Issue ready for Engineering Triage label May 17, 2022
@mattleibow mattleibow modified the milestones: 6.0.300, 6.0-servicing Aug 29, 2022
@Redth Redth modified the milestones: 6.0-servicing, Backlog Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@samhouts samhouts removed the s/verified Verified / Reproducible Issue ready for Engineering Triage label Apr 5, 2023
@samhouts samhouts modified the milestones: Backlog, Under Consideration Jul 26, 2023
@mfeingol
Copy link

@PureWeen: any updates on this issue. I've resumed porting my app to Maui with the current .NET 8.0 preview and ... this is still an issue. Thanks.

@matthewrdev
Copy link
Contributor

matthewrdev commented Mar 15, 2024

@SteveSandersonMS @PureWeen A workaround for this is to disable UserInputEnabled on the ViewPager2 in the TabbedPage's OnHandlerChanged event:

    protected override void OnHandlerChanged()
    {
        base.OnHandlerChanged();

#if ANDROID
        var view = this.Handler.PlatformView;

        if (view is AndroidX.ViewPager2.Widget.ViewPager2 viewPager)
        {
            viewPager.UserInputEnabled = false;
        }
#endif
    }
    ```

@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
@PureWeen PureWeen modified the milestones: Under Consideration, Backlog Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-webview WebView p/2 Work that is important, but is currently not scheduled for release platform/android 🤖 t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.