webfer/extend_accessibility_webform 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

webfer/extend_accessibility_webform

Composer 安装命令:

composer require webfer/extend_accessibility_webform

包简介

Improves Webform client-side validation errors by replacing error labels with an accessible span (role=alert) and wiring it to aria-describedby.

README 文档

README

A Drupal custom module that improves the accessibility of Webform client-side validation errors by converting jQuery Validate error labels into a live region span, and ensuring the related input is described by the error message.

🚀 Why? Client-side validation often injects error labels that are not reliably announced by assistive technologies. This module makes the error message behave like an assertive alert and wires it into aria-describedby.

📦 Module Overview

  • Name: Extend Accessibility Webform
  • Package: Custom
  • Compatibility: Drupal 10, 11

This module:

  • Automatically attaches a small JavaScript library to all Webform submission forms.
  • Overrides jQuery Validate showErrors() to post-process error elements.
  • Replaces error <label class="error" ...> elements with:
    • <span role="alert" aria-live="assertive" ...>
    • the original error text
  • Ensures the related input includes the error element ID in aria-describedby.

Key features

  • Automatic attachment (no per-form configuration)
  • Accessibility-first output (role="alert", aria-live="assertive")
  • Safe against repeated replacements via a data-error-replaced flag

🛠 Installation

✅ Install with Composer (recommended) 🧰

From your Drupal project root:

composer require webfer/extend_accessibility_webform

Composer will install the module into your Drupal codebase (commonly under web/modules/contrib/ in standard Drupal Composer templates). 📦

Then enable the module:

  • 📍 Admin > Extend → enable Extend Accessibility Webform, or
  • 💻 drush en extend_accessibility_webform -y

🧩 Install without Composer (development only)

If you’re developing locally, you can still place the module folder under:

  • web/modules/custom/extend_accessibility_webform

✅ Requirements

Drupal

  • Drupal core 10/11

Dependencies

  • webform (Webform submission forms)
  • clientside_validation (provides the jQuery Validate integration)

Notes:

  • This module relies on the presence of jQuery Validate ($.validator). The attached library depends on clientside_validation/jquery.validate.
  • The module does not add any admin UI, permissions, or configuration schema.

⚙ Configuration

No configuration is required.

The module attaches its library to Webform submission forms by detecting:

  • form IDs that start with webform_submission_, or
  • the webform-submission-form CSS class on the rendered form.

🧩 Usage

What you’ll see

When a Webform submission form fails client-side validation, jQuery Validate normally renders an error label like:

<label id="edit-email-error" class="error" for="edit-email">Required</label>

This module replaces it with a <span> that is announced as an alert:

<span id="edit-email-error" class="error" role="alert" aria-live="assertive" data-error-replaced="true">
  Required
</span>

It also updates the related input so that it references the error element via aria-describedby.

🚨 Troubleshooting

  • Nothing changes on the form

    • Confirm webform and clientside_validation are enabled.
    • Confirm client-side validation is enabled for the Webform and that errors are being rendered by jQuery Validate (look for $.validator in the browser console).
    • Rebuild caches (drush cr) after enabling the module.
  • Errors render, but no replacement happens

    • Another script may be overriding $.validator.setDefaults() after this module runs.
    • Ensure you don’t have another custom module doing a similar override (for example, the earlier extend_clientside_validation_webform clone).

📂 File Structure

extend_accessibility_webform/
├── README.md
├── extend_accessibility_webform.info.yml
├── extend_accessibility_webform.libraries.yml
├── extend_accessibility_webform.module
└── js/
    └── custom-error-wrap.js

📜 License

This project is licensed under the GNU General Public License, version 2 or (at your option) any later version.

  • SPDX identifier: GPL-2.0-or-later
  • Created by: WebFer

_Created and maintained by WebFer

webfer/extend_accessibility_webform 适用场景与选型建议

webfer/extend_accessibility_webform 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 78 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「validation」 「webform」 「drupal」 「accessibility」 「ARIA」 「a11y」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 webfer/extend_accessibility_webform 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 webfer/extend_accessibility_webform 我们能提供哪些服务?
定制开发 / 二次开发

基于 webfer/extend_accessibility_webform 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 78
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 35
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-03-18