Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] [UWP] First Entry gets focus if loaded inside ScrollView #10420

Open
LakshmiNatarajan21 opened this issue Apr 23, 2020 · 4 comments
Open

Comments

@LakshmiNatarajan21
Copy link

LakshmiNatarajan21 commented Apr 23, 2020

Description

When the Entry control is loaded inside the ScrollView and tapping the empty space of the view, the First entry gets focus in the UWP platform.

I have found a workaround for this issue in the following discussion,
https://stackoverflow.com/questions/42064603/xamarin-forms-scrollview-click-always-sets-focus-on-first-item-of-child-grid

But, this workaround is broken from Xamarin.Forms Version 3.6.

The workaround resolves the issue in XF 3.5.

Steps to Reproduce

  1. Run the sample in the UWP platform.
  2. Click any entry control. Then click the empty space of the ScrollView.
  3. First entry element gets focus.

Expected Behavior

Focus should be disabled for all entry items.

Actual Behavior

First entry gets focus.

Basic Information

The reported issue does not occur, when adding Entry inside Grid. Please see the video which reproduces the issue.

  • Version with issue: 3.6
  • Last known good version: 3.5
  • IDE:
  • Platform Target Frameworks:
    • iOS:
    • Android:
    • UWP: Yes

Screenshots

Video

Reproduction Link

ScrollViewSample

Workaround

1

public class ScrollViewCustomRenderer : ScrollViewRenderer
   {
       protected override void OnElementChanged(ElementChangedEventArgs<ScrollView> e)
       {
           base.OnElementChanged(e);

           if (Control == null)
               return;

           Control.IsTabStop = true;
       }
   }

But, workaround broken from XF 3.5.

2
microsoft/microsoft-ui-xaml#597 (comment) - As discussed in this comment, Duplicating ScrollViewRenderer without IDontGetFocus interface also seems to work.

But, we have our own custom renderer and we cant implement the actual ScrollViewRenderer.

@LakshmiNatarajan21 LakshmiNatarajan21 added s/unverified New report that has yet to be verified t/bug 🐛 labels Apr 23, 2020
@jsuarezruiz jsuarezruiz added a/entry a/scrollview p/UWP e/3 🕒 3 and removed s/unverified New report that has yet to be verified labels Apr 23, 2020
@myokeeh
Copy link

myokeeh commented May 28, 2020

Does this mean we might see a fix for this bug in one of the upcoming previews?

@Suriman
Copy link

Suriman commented Sep 7, 2020

The current behavior does not make sense. Neither in UWP nor in mobile. If the behavior of other applications is observed, the correct one is not to scroll to the first element of the form.

Would it be possible to advance the implementation of this issue?

@samhouts samhouts removed this from the 5.0.0 milestone Nov 2, 2020
@Sergtek
Copy link

Sergtek commented Jul 13, 2021

Any news about it? Does anyone know of any workarounds until it is officially fixed? I tried the solution that is proposed in the following link:
https://stackoverflow.com/questions/42064603/xamarin-forms-scrollview-click-always-sets-focus-on-first-item-of-child-grid
But no it works in the latest versions of Xamarin.Forms.

@Sergtek
Copy link

Sergtek commented Jul 13, 2021

I have prepared a sample where the problem can be reproduced:
https://github.com/nacompllo/SfNestedsListView

I have also prepared a video on how to reproduce the problem in the example.
https://www.youtube.com/watch?v=PVMyaqifD3w

The example is using Xamarin.Forms version 5.0.0.2083.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants