Skip to content

Inputs dialog shows dismiss button even when ShowDismiss = false #10345

Description

@eerhardt
  • I have searched the existing issues

Describe the bug
When calling PromptInputsAsync with ShowDismiss = false in InputsDialogInteractionOptions, the dialog still displays a dismiss button. This seems to ignore the ShowDismiss parameter.

Expected Behavior
When the PromptInputsAsync dialog is shown with ShowDismiss = false, the dialog should NOT display a dismiss button.

Steps To Reproduce
Use the following code to create a hosted service with an interaction prompt:

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIREINTERACTION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

var builder = DistributedApplication.CreateBuilder(args);

builder.Services.AddHostedService<WebStoryHostedService>();

builder.Build().Run();

internal sealed class WebStoryHostedService(IInteractionService interactionService) : BackgroundService
{
    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {
        var result = await interactionService.PromptMessageBarAsync(
            "A title",
            "a message",
            new MessageBarInteractionOptions
            {
                PrimaryButtonText = "Enter values"
            },
            cancellationToken: stoppingToken);

        if (result.Data)
        {
            await interactionService.PromptInputsAsync(
                "Input",
                "Please enter some input",
                [
                        new InteractionInput { InputType = InputType.Text, Label = "One", },
                        new InteractionInput { InputType = InputType.Text, Label = "Two", },
                ],
                new InputsDialogInteractionOptions
                {
                    ShowDismiss = false
                },
                stoppingToken);
        }
    }
}
Image

cc @JamesNK

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions