Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 29, 2025

The OK button in the SfPicker footer would become invisible after the first click when using dialog mode, though the tap gesture would still work in the invisible area. This was caused by insufficient validation logic in the AddConfirmButton() method that could result in the button being removed from the UI while maintaining object references.

Root Cause

The issue was in the FooterLayout.AddConfirmButton() method which had this logic:

if (_confirmButtonView != null)
{
    return; // Early return - button might exist but not be in Children collection
}

In certain scenarios (such as after dialog close/reopen cycles), the button could be removed from the Children collection but the _confirmButtonView reference would remain, causing subsequent calls to return early without ensuring the button was actually visible in the UI.

Solution

Enhanced the validation logic to check both the button view and button references, and ensure the button is present in the Children collection:

if (_confirmButtonView != null && _confirmButton != null)
{
    // If button exists but is not in Children collection, add it back
    if (!Children.Contains(_confirmButton))
    {
        Children.Add(_confirmButton);
    }
    return;
}

This ensures that:

  • If a button exists but is missing from the UI, it gets re-added
  • No duplicate buttons are created
  • The existing button creation and cleanup logic remains unchanged
  • Both OK and Cancel buttons behave consistently

Testing

Added a unit test to verify that the OK button remains stable after various property changes and multiple dialog interactions.

The fix is minimal, surgical, and addresses the core issue without introducing side effects or breaking changes.

Fixes #238.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] SfPicker - Ok-Button diappears after first click Fix SfPicker OK button disappearing after first click in dialog mode Jul 29, 2025
Copilot AI requested a review from PaulAndersonS July 29, 2025 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SfPicker - Ok-Button diappears after first click

2 participants