Browse Source

Render abp-select info as <div class="form-text"> with aria-describedby

- Replace <small> with <div> to match abp-input and the Bootstrap 5 form-text guidance
- Add aria-describedby on the select so screen readers announce the description
pull/25352/head
maliming 3 weeks ago
parent
commit
4c58ca165f
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 12
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs

12
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs

@ -251,12 +251,14 @@ public class AbpSelectTagHelperService : AbpTagHelperService<AbpSelectTagHelper>
var idAttr = inputTag.Attributes.FirstOrDefault(a => a.Name == "id");
var localizedText = _tagHelperLocalizer.GetLocalizedText(text, TagHelper.AspFor.ModelExplorer);
var small = new TagBuilder("small");
small.Attributes.Add("id", idAttr?.Value?.ToString() + "InfoText");
small.AddCssClass("form-text");
small.InnerHtml.Append(localizedText);
var div = new TagBuilder("div");
div.Attributes.Add("id", idAttr?.Value + "InfoText");
div.AddCssClass("form-text");
div.InnerHtml.Append(localizedText);
return small.ToHtmlString();
inputTag.Attributes.Add("aria-describedby", idAttr?.Value + "InfoText");
return div.ToHtmlString();
}
protected virtual List<SelectListItem> GetSelectItemsFromEnum(TagHelperContext context, TagHelperOutput output, ModelExplorer explorer)

Loading…
Cancel
Save