@@ -68,75 +68,15 @@ export function hasAccessibleLabel(
6868 const allowDescribedBy = ! ! config . allowDescribedBy ;
6969 const allowLabeledChild = ! ! config . allowLabeledChild ;
7070 const allowTextContentChild = ! ! config . allowTextContentChild ;
71-
72- console . log ( "hasAccessibleLabel called with:" , {
73- component : config . component ,
74- attributes : opening . attributes ,
75- allowFieldParent,
76- allowWrappingLabel,
77- allowHtmlFor,
78- allowLabelledBy,
79- allowTooltipParent,
80- allowDescribedBy,
81- allowLabeledChild,
82- allowTextContentChild
83- } ) ;
84-
85- if ( allowFieldParent ) {
86- const res = hasFieldParent ( context ) ;
87- console . log ( "hasFieldParent:" , res ) ;
88- if ( res ) return true ;
89- }
90-
91- if ( config . labelProps ?. length ) {
92- const res = config . labelProps . some ( p => hasNonEmptyProp ( opening . attributes , p ) ) ;
93- console . log ( "hasNonEmptyProp:" , res , config . labelProps ) ;
94- if ( res ) return true ;
95- }
96-
97- if ( allowWrappingLabel ) {
98- const res = isInsideLabelTag ( context ) ;
99- console . log ( "isInsideLabelTag:" , res ) ;
100- if ( res ) return true ;
101- }
102-
103- if ( allowHtmlFor ) {
104- const res = hasAssociatedLabelViaHtmlFor ( opening , context ) ;
105- console . log ( "hasAssociatedLabelViaHtmlFor:" , res ) ;
106- if ( res ) return true ;
107- }
108-
109- if ( allowLabelledBy ) {
110- const res = hasAssociatedLabelViaAriaLabelledBy ( opening , context ) ;
111- console . log ( "hasAssociatedLabelViaAriaLabelledBy:" , res ) ;
112- if ( res ) return true ;
113- }
114-
115- if ( allowTooltipParent ) {
116- const res = hasToolTipParent ( context ) ;
117- console . log ( "hasToolTipParent:" , res ) ;
118- if ( res ) return true ;
119- }
120-
121- if ( allowDescribedBy ) {
122- const res = hasAssociatedLabelViaAriaDescribedby ( opening , context ) ;
123- console . log ( "hasAssociatedLabelViaAriaDescribedby:" , res ) ;
124- if ( res ) return true ;
125- }
126-
127- if ( allowLabeledChild ) {
128- const res = hasLabeledChild ( opening , context ) ;
129- console . log ( "hasLabeledChild:" , res ) ;
130- if ( res ) return true ;
131- }
132-
133- if ( allowTextContentChild ) {
134- const res = hasTextContentChild ( element ) ;
135- console . log ( "hasTextContentChild:" , res ) ;
136- if ( res ) return true ;
137- }
138-
139- console . log ( "No accessible label found, returning false." ) ;
71+ if ( allowFieldParent && hasFieldParent ( context ) ) return true ;
72+ if ( config . labelProps ?. some ( p => hasNonEmptyProp ( opening . attributes , p ) ) ) return true ;
73+ if ( allowWrappingLabel && isInsideLabelTag ( context ) ) return true ;
74+ if ( allowHtmlFor && hasAssociatedLabelViaHtmlFor ( opening , context ) ) return true ;
75+ if ( allowLabelledBy && hasAssociatedLabelViaAriaLabelledBy ( opening , context ) ) return true ;
76+ if ( allowTooltipParent && hasToolTipParent ( context ) ) return true ;
77+ if ( allowDescribedBy && hasAssociatedLabelViaAriaDescribedby ( opening , context ) ) return true ;
78+ if ( allowLabeledChild && hasLabeledChild ( opening , context ) ) return true ;
79+ if ( allowTextContentChild && hasTextContentChild ( element ) ) return true ;
14080 return false ;
14181}
14282
0 commit comments