Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Clarify where ngDisabled should be used #15473

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ng/directive/attrs.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
*
* @description
*
* This directive sets the `disabled` attribute on the element if the
* This directive sets the `disabled` attribute on a form element if the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be more confusing than helpful. ("form element" often refers to the <form> element.)
How about:

This directive sets the disabled attribute on the element (typically a form control) if the...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there are only these element that natively respond to disabled: option, input, textarea, button, select. Why not list them all?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are more (e.g. optgroup, fieldset). Plus there is nothing stopping people from using it on elements that don't natively respond to disabed, such as custom controls. I wouldn't make too strong a statement (i.e. "it can be used on these elements only). Mentioning the common usecase is fine though (either under the general term "form controls" or by explicit listing).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I meant list all the elements that are supported natively, but not write that they can be used only on these elements. I'm fine with

(typically a form control, e.g. input, button, select etc.)

* {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.
*
* A special directive is necessary because we cannot use interpolation inside the `disabled`
Expand Down