From 3b15e6d48e0b3b2f945f5c03320a05e741ed32eb Mon Sep 17 00:00:00 2001 From: Alberto Medina Gutierrez Date: Mon, 20 Jul 2020 17:34:49 -0700 Subject: [PATCH] Add warning for empty label in required input --- .../AdaptiveCards.Rendering.Wpf/AdaptiveContainerRenderer.cs | 4 ++++ source/dotnet/Library/AdaptiveCards/AdaptiveWarning.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source/dotnet/Library/AdaptiveCards.Rendering.Wpf/AdaptiveContainerRenderer.cs b/source/dotnet/Library/AdaptiveCards.Rendering.Wpf/AdaptiveContainerRenderer.cs index 1c9d1fe41b..1069b436c6 100644 --- a/source/dotnet/Library/AdaptiveCards.Rendering.Wpf/AdaptiveContainerRenderer.cs +++ b/source/dotnet/Library/AdaptiveCards.Rendering.Wpf/AdaptiveContainerRenderer.cs @@ -372,6 +372,10 @@ public static FrameworkElement EncloseElementInPanel(AdaptiveRenderContext conte panel.Children.Add(RenderLabel(context, inputElement, elementForAccessibility)); AddSpacing(context, context.Config.Inputs.Label.InputSpacing, panel); } + else if (inputElement.IsRequired) + { + context.Warnings.Add(new AdaptiveWarning((int)AdaptiveWarning.WarningStatusCode.EmptyLabelInRequiredInput, "Input is required but there's no label for required hint rendering")); + } panel.Children.Add(enclosingElement); enclosingElement = panel; diff --git a/source/dotnet/Library/AdaptiveCards/AdaptiveWarning.cs b/source/dotnet/Library/AdaptiveCards/AdaptiveWarning.cs index 58256fe00f..1a5b886ba4 100644 --- a/source/dotnet/Library/AdaptiveCards/AdaptiveWarning.cs +++ b/source/dotnet/Library/AdaptiveCards/AdaptiveWarning.cs @@ -6,7 +6,7 @@ namespace AdaptiveCards public class AdaptiveWarning { // TODO #2749: temporary warning code for fallback card. Remove when common set of error codes created and integrated. - public enum WarningStatusCode { UnsupportedSchemaVersion = 7, InvalidLanguage = 12, MaxActionsExceeded = 13 }; + public enum WarningStatusCode { UnsupportedSchemaVersion = 7, InvalidLanguage = 12, MaxActionsExceeded = 13, EmptyLabelInRequiredInput = 14 }; public AdaptiveWarning(int code, string message) {