maui icon indicating copy to clipboard operation
maui copied to clipboard

Hiding keyboard prevents button command from firing

Open williambuchanan2 opened this issue 2 years ago • 1 comments

Description

This is a problem in iOS only... I have a page which has an editor and button on the bottom. The user enters text in the editor then taps the button to submit the data.

The problem I have is when I tap the button, nothing happens. On the first tap of the button, the keyboard hides itself, and so the editor and button drop to the bottom of the screen, but the button command doesn't fire.

The user has to tap the button a second time to make the button command fire, which is super annoying.

It seems to be related to the keyboard. If I add something in below the editor, and set it's height so that it forces the editor higher up on the screen above the keyboard the problem goes away (but I then have a big white space on the screen). See 'KeyboardFix' border in the XAML below. So by making that single change the problem comes and goes.

I have also noticed it can intermittently work for a couple of taps, but then it stops working again.

IMG_D2954DC66759-1 2

Steps to Reproduce

    <VerticalStackLayout HorizontalOptions="FillAndExpand" VerticalOptions="StartAndExpand">

        <Line HeightRequest="1" Margin="0" HorizontalOptions="StartAndExpand" VerticalOptions="Start"/>

        <StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" VerticalOptions="Fill" Margin="5">
            <Border StrokeThickness="1" StrokeShape="RoundRectangle 10,10,10,10" Padding="10" HorizontalOptions="FillAndExpand" VerticalOptions="Start"
                Background="{AppThemeBinding Light={StaticResource PageBackgroundLight}, Dark={StaticResource PageBackground}}">
                <Editor Text="{Binding NewComment}" Placeholder="Comment"  Focused="Editor_Focused" AutoSize="TextChanges" HorizontalOptions="FillAndExpand" VerticalOptions="Fill" MaximumHeightRequest="80" Keyboard="Chat"/>
            </Border>
            <Button Background="Transparent" Text="" ImageSource="send24x24.png"  HorizontalOptions="End"  VerticalOptions="Start" Margin="5"  
                        Command="{Binding Source={RelativeSource AncestorType={x:Type vm:RedSixBaseVm}}, Path=CommentButtonClickedCommand}" />
            <!--<Border x:Name="KeyboardFix" HeightRequest="400" Stroke="Transparent" BackgroundColor="Transparent"/>-->
        </StackLayout>
    </VerticalStackLayout>

Link to public reproduction project repository

N/A

Version with bug

7.0.92

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 16

Did you find any workaround?

No

Relevant log output

No response

williambuchanan2 avatar Oct 04 '23 07:10 williambuchanan2

@tj-devel709 just checking if you are aware of this one as well - could be related to what you are working on with the keyboard at the moment.

williambuchanan2 avatar Jan 08 '24 22:01 williambuchanan2

Verified this issue was not repro on Visual Studio 17.10.0 Preview 2. I added a <Editor> control to the template Maui that does not repro this issue. If you still repro it, please provide a repo and I'll try again.

QianaJiao avatar Mar 15 '24 01:03 QianaJiao

Hi @williambuchanan2. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

Just tested in latest version and the problem is still there. Reproducable using the information above.

williambuchanan2 avatar Mar 18 '24 22:03 williambuchanan2

@williambuchanan2 did you by any chance found a workaround is EXTREMELY annoying!

gabsamples6 avatar Apr 26 '24 16:04 gabsamples6

@williambuchanan2 did you by any chance found a workaround is EXTREMELY annoying!

Hi, sorry - no I didn't find a workaround for this. It's a terrible user experience having to tap the button twice and the keyboard vanishing when you do so I agree it is extremely annoying. All the different keyboard functionality they seem to have added for showing and hiding the keyboard is pretty lame as well and doesn't seem well thought out to me, so the end result is that none of that helps with this problem.

williambuchanan2 avatar Apr 29 '24 05:04 williambuchanan2

This is causing issues with many of our screens.. @QianaJiao @samhouts this issue is still present in 8.0.21 - is there any chance that can be looked at and included in the next release? Many thanks

gabsamples6 avatar Apr 29 '24 12:04 gabsamples6

Dont get it why this was added to the backlog - its affecting many of our screens. Workaround at least?

gabsamples6 avatar Jun 17 '24 16:06 gabsamples6

I have this issue as well and very annoying and a client tester already filed an issue with us .. it looks like it's not going to be fixed and we are stuck.. and issue still occurs on 8.0.70

TedMobile avatar Jul 17 '24 10:07 TedMobile

This still happens with buttons, but not TapGestureRecognisers for some reason. Our workaround was to create a border that looked identical to our buttons, and add a TapGestureRecogniser to it. When clicking this when the keyboard is up the command gets called straight away

Zack-G-I-T avatar Jul 17 '24 15:07 Zack-G-I-T

This still happens with buttons, but not TapGestureRecognisers for some reason. Our workaround was to create a border that looked identical to our buttons, and add a TapGestureRecogniser to it. When clicking this when the keyboard is up the command gets called straight away

Thanks for the tip for the workaround. It's a sad state of affairs when you have to do stuff like this just to get basic things working!

williambuchanan2 avatar Jul 18 '24 03:07 williambuchanan2

Thanks for the workaround @Zack-G-I-T , i had the same issue and worked but as @williambuchanan2 says is absolutely ridiculous that we have to do this stuff, and because this issue is in the backlog , the chances of getting fixed are so low!

developer9969 avatar Jul 18 '24 13:07 developer9969