Skip to content

Add support for adding/removing aria and other attributes as validation is added/removed in the code when using the Reactive Forms (previously model-driven forms) approach #9121

Description

@DeborahK
  • I'm submitting a ...
  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

Current behavior
When using the reactive forms/model-driven approach, the validation rules for HTML input elements are defined in the component class, not the HTML as attributes. This is great in that the validation can be tailored to different user types or application state. For example, a field is required for normal users but not required for admin users.

However, we lose some built-in browser functionality when these attributes are not defined in the HTML, such as limiting character entry (maxlength) and supporting accessibility (required or aria-required)

Expected/desired behavior
For built-in validation types, provide the option to add/remove attributes automatically. For example, adding the Validator.required to a control in the class should automatically add the required attribute to the DOM.

For custom validation, provide a way for the validation author to specify the attributes to add/remove from the DOM.

  • Please tell us about your environment:
  • Angular version: 2.0.0-RC
  • Browser: all
  • Language: all

Metadata

Metadata

Assignees

Labels

Accessibilityissues related to accessibility (a11y)area: formsfeatureLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under consideration

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions