Skip to content

Commit d02477b

Browse files
committed
updated comments on factory
1 parent ad02c7b commit d02477b

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/util/ruleFactory.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,19 @@ export type LabeledControlConfig = {
2121
messageId: string;
2222
description: string;
2323
labelProps: string[]; // e.g. ["aria-label", "title", "label"]
24-
/** Accept a parent <Field label="..."> wrapper as providing the label. */
25-
allowFieldParent: boolean; // default false
26-
allowHtmlFor: boolean /** Accept <label htmlFor="..."> association. */;
27-
allowLabelledBy: boolean /** Accept aria-labelledby association. */;
28-
allowWrappingLabel: boolean /** Accept being wrapped in a <label> element. */;
29-
allowTooltipParent: boolean /** Accept a parent <Tooltip content="..."> wrapper as providing the label. */;
24+
allowFieldParent: boolean; // Accept a parent <Field label="..."> wrapper as providing the label.
25+
allowHtmlFor: boolean; // Accept <label htmlFor="..."> association.
26+
allowLabelledBy: boolean; // Accept aria-labelledby association.
27+
allowWrappingLabel: boolean; // Accept being wrapped in a <label> element.
28+
allowTooltipParent: boolean; // Accept a parent <Tooltip content="..."> wrapper as providing the label.
3029
/**
3130
* Accept aria-describedby as a labeling strategy.
3231
* NOTE: This is discouraged for *primary* labeling; prefer text/aria-label/labelledby.
3332
* Keep this off unless a specific component (e.g., Icon-only buttons) intentionally uses it.
3433
*/
3534
allowDescribedBy: boolean;
36-
// NEW: treat labeled child content (img alt, svg title, aria-label on role="img") as the name
37-
allowLabeledChild: boolean;
38-
allowTextContentChild?: boolean;
35+
allowLabeledChild: boolean; // Accept labeled child elements to provide the label e.g. <Button><img alt="..." /></Button>
36+
allowTextContentChild?: boolean; // Accept text children to provide the label e.g. <Button>Click me</Button>
3937
};
4038

4139
/**

0 commit comments

Comments
 (0)