Skip to content

[regression/8.0.3] Disabling RefreshView disables the keyboard #19091

Open

Description

Description

This might be related to a change in the Android SDK or maybe in the MAUI keyboard/View implementation, but disabling a RefreshView with refreshView.IsEnabled = false disables keyboard entry into textareas (and probably inputs too) in MAUI Blazor. Haven't had the chance to try if native inputs were affected yet.

Steps to Reproduce

  1. Create a new MAUI Blazor Hybrid project
  2. Wrap the BlazorWebView in a RefreshView
  3. Set IsEnabled on the RefreshView to false
  4. Add a textarea to the Razor view
  5. Run the application, tap into the textarea and start typing
  6. Caret doesn't appear, input is ignored

Link to public reproduction project repository

No response

Version with bug

8.0.3

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

7.0.101

Affected platforms

Android

Affected platform versions

Android 11 and Android 14 confirmed

Did you find any workaround?

Yes, we're currently using the following workaround:

// Platforms/Android/CustomDisableSwipeRefreshLayout.cs
public class CustomDisableSwipeRefreshLayout : MauiSwipeRefreshLayout
{
    public bool DisableRefresh { get; set; }

    public CustomDisableSwipeRefreshLayout(Context context) : base(context)
    {
    }

    public override bool CanChildScrollUp()
    {
        if (DisableRefresh)
            return true;

        return base.CanChildScrollUp();
    }
}

with a custom ViewHandler, we are abusing CanChildScrollUp to disable refresh without disabling the Control itself, and then setting it directly:

// Platforms/Android/ViewHandlers/RefreshViewHandler.cs
public class RefreshViewHandler : Microsoft.Maui.Handlers.RefreshViewHandler
{
    protected override MauiSwipeRefreshLayout CreatePlatformView()
    {
        return new CustomDisableSwipeRefreshLayout(Context);
    }
}
// MauiProgram.cs
handlers.AddHandler<RefreshView, RefreshViewHandler>();
// Usage
#if ANDROID
    if (RefreshViewInstance.Handler?.PlatformView is CustomDisableSwipeRefreshLayout platformView)
    {
        platformView.DisableRefresh = !isReloadable;   
    }
    else
    {
        RefreshViewInstance.IsEnabled = isReloadable;
    }
#else
    RefreshViewInstance.IsEnabled = isReloadable;
#endif

Obviously, it would be nicer to inherit from RefreshView and fully implement this in the MAUI view itself, but this works as a quick and dirty patch.

Relevant log output

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area-controls-refreshviewRefreshViewarea-keyboardKeyboard, soft keyboardi/regressionThis issue described a confirmed regression on a currently supported versionplatform/android 🤖s/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions