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

iOS Next Entry to skip hidden parents #20160

Merged
merged 1 commit into from Feb 1, 2024
Merged

Conversation

tj-devel709
Copy link
Contributor

Description of Change

We have a bug in iOS when using an Entry's Next ReturnType. If the next 'available' entry/editor is not visible, we skip it and go on to the next available entry/editor. However, if the parent of the next 'available' entry/editor is not visible and the 'available' entry/editor is not marked as not visible, we will still go into it.

In the search for the next entry/editor, we go through the current controls siblings, then go up a level to the parent's siblings and look into their children. Because of this, we can simply check if the parent is visible and go onto the next parent if so.

Before After
HiddenEntry-Before.mov
HiddenEntry-After.mov

Code Snippet from original issue (click me!)

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiApp1.MainPage">
    <ScrollView>
        <VerticalStackLayout Padding="30,0" Spacing="25">
            <Entry Placeholder="entry1" ReturnType="Next"/>

            <Grid IsVisible="False">
                <Entry x:Name="hiddenEntry2" Placeholder="hiddenEntry2" ReturnType="Next" Focused="HiddenEntry2Focused"/>
            </Grid>

            <Entry Placeholder="entry3" ReturnType="Next" Focused="Entry3Focused"/>
        </VerticalStackLayout>
    </ScrollView>
</ContentPage>
namespace MauiApp1
{
    public partial class MainPage : ContentPage
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void HiddenEntry2Focused(object sender, FocusEventArgs e)
        {
            Console.WriteLine("Hidden entry: IsVisible: " + hiddenEntry2.IsVisible);
        }

        private void Entry3Focused(object sender, FocusEventArgs e)
        {
            Console.WriteLine("Hidden entry: IsVisible: " + hiddenEntry2.IsVisible);
        }
    }
}

Issues Fixed

Fixes #19139

@tj-devel709 tj-devel709 added platform/iOS 🍎 area/a11y Relates to accessibility area/controls 🎮 Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor control-entry Entry area/keyboard labels Jan 25, 2024
@tj-devel709 tj-devel709 marked this pull request as ready for review January 25, 2024 19:48
@tj-devel709 tj-devel709 requested a review from a team as a code owner January 25, 2024 19:48
@samhouts samhouts removed the area/controls 🎮 Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Jan 31, 2024
@rmarinho rmarinho merged commit e5f58c1 into main Feb 1, 2024
47 checks passed
@rmarinho rmarinho deleted the dev/TJ/HiddenNextEntry branch February 1, 2024 12:31
@github-actions github-actions bot locked and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IsVisible false is not propagated to child controls
3 participants