You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为Select2下拉框与Bootstrap日期选择器添加屏幕阅读器功能?

为Select2下拉框和Bootstrap日历添加屏幕阅读器无障碍支持

我网站上的Select2下拉框和Bootstrap日历组件功能正常,但无法满足残障用户的访问需求,目前正在尝试为它们添加屏幕阅读器适配功能,实现网站的无障碍访问。

我已经针对这个问题做了大量研究,通过调试器添加了aria-label代码,也参考了各类下拉框与日历组件的无障碍示例。附上相关页面的代码及调试器截图,需要更多信息可以随时告知,感谢抽出时间提供协助。

CSHTML页面代码

<div>
    @Html.CustomEditorFor(model => model.HouseDetails.HouseTypeID, CachedTableTypes.CUSTOM_HouseTypes)
</div>
    
<div>
    @Html.CustomEditorFor(model => model.DateStart)
</div>

Extension.cs页面代码

public static MvcHtmlString CustomEditorFor<TModel, TValue>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TValue>> expression, CachedTableTypes cacheTableName, object htmlAttributes = null, bool excludeLabel = false, string appendedText = null)
        {
            var selectedValue = GetValue(htmlHelper, expression);

            string editor = SelectExtensions.DropDownListFor(htmlHelper, expression, WebHelper.GetSelectListFromCache(cacheTableName, (string)htmlHelper.ViewData["CurrentCulture"], selectedValue)).ToString();

            return htmlHelper.InputWrapper(editor, expression, htmlAttributes, excludeLabel, appendedText);
        }

(注:原内容包含日历调试器页面截图、下拉框调试器页面截图)

内容的提问来源于stack exchange,提问作者nintendofan10039

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 19:50:34