Skip to content

Commit 5cc9ecf

Browse files
srikant-ch5matthoward366tomlyn
authored
#2326 Accessibility Violations in Common Properties Controls without Label (#2327)
Signed-off-by: srikant <[email protected]> Signed-off-by: CTomlyn <[email protected]> Co-authored-by: Matt Howard <[email protected]> Co-authored-by: CTomlyn <[email protected]>
1 parent cff2eb5 commit 5cc9ecf

File tree

10 files changed

+20
-0
lines changed

10 files changed

+20
-0
lines changed

canvas_modules/common-canvas/src/common-properties/components/control-item/control-item.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ class ControlItem extends React.Component {
8686
{indicator}
8787
{tooltip}
8888
</div>);
89+
} else {
90+
// Provide a label for controls with hidden labels to support accessibility
91+
label = (
92+
<div className={classNames("properties-label-container-hidden")}>
93+
<label className="properties-control-label-hidden">{this.props.control?.label?.text}</label>
94+
</div>);
8995
}
9096

9197
const action = this.actionFactory.generateAction(0, this.props.control.action);

canvas_modules/common-canvas/src/common-properties/components/control-item/control-item.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@
6464
}
6565
}
6666

67+
.properties-label-container-hidden {
68+
display: none;
69+
}
70+
6771
.properties-label-container, .properties-summary-link-container, .properties-checkbox-tooltip-container, .properties-radioset-panel {
6872
.tooltip-container {
6973
display: flex;

canvas_modules/common-canvas/src/common-properties/controls/checkbox/checkbox.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class CheckboxControl extends React.Component {
8080
hideLabel={this.props.tableControl}
8181
helperText={this.props.control.helperText}
8282
readOnly={this.props.readOnly}
83+
aria-label={this.props.control.labelVisible ? null : this.props.control?.label?.text}
8384
/>
8485
{tooltipIcon}
8586
</div>

canvas_modules/common-canvas/src/common-properties/controls/checkboxset/checkboxset.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ class CheckboxsetControl extends React.Component {
128128
legendText={this.props.controlItem}
129129
helperText={this.props.control.helperText}
130130
readOnly={this.props.readOnly}
131+
aria-label={this.props.control.labelVisible ? null : this.props.control?.label?.text}
131132
>
132133
<div className={classNames("properties-checkboxset-container", this.props.messageInfo ? this.props.messageInfo.type : null)}>
133134
{checkboxes}

canvas_modules/common-canvas/src/common-properties/controls/datefield/datefield.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class DatefieldControl extends React.Component {
8585
labelText={this.props.controlItem}
8686
hideLabel={this.props.tableControl}
8787
readOnly={this.props.readOnly}
88+
aria-label={this.props.control.labelVisible ? null : this.props.control?.label?.text}
8889
/>
8990
<ValidationMessage inTable={this.props.tableControl} tableOnly state={this.props.state} messageInfo={this.props.messageInfo} />
9091
</div>

canvas_modules/common-canvas/src/common-properties/controls/dropdown/dropdown.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ class DropDown extends React.Component {
260260
value={selection}
261261
helperText={this.props.control.helperText}
262262
readOnly={this.props.readOnly}
263+
aria-label={this.props.control.labelVisible ? null : this.props.control?.label?.text}
263264
>
264265
{ options }
265266
</Select>
@@ -302,6 +303,7 @@ class DropDown extends React.Component {
302303
titleText={this.props.controlItem}
303304
helperText={this.props.control.helperText}
304305
readOnly={this.props.readOnly}
306+
aria-label={this.props.control.labelVisible ? null : this.props.control?.label?.text}
305307
/>
306308
);
307309
}

canvas_modules/common-canvas/src/common-properties/controls/numberfield/numberfield.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ class NumberfieldControl extends React.Component {
165165
helperText={this.props.control.helperText}
166166
readOnly={this.props.readOnly}
167167
disableWheel
168+
aria-label={this.props.control.labelVisible ? null : this.props.control?.label?.text}
168169
/>
169170
{numberGenerator}
170171
<ValidationMessage inTable={this.props.tableControl} tableOnly state={this.props.state} messageInfo={this.props.messageInfo} />

canvas_modules/common-canvas/src/common-properties/controls/passwordfield/passwordfield.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class PasswordControl extends React.Component {
6565
showPasswordLabel={showPasswordLabel}
6666
hidePasswordLabel={hidePasswordLabel}
6767
helperText={this.props.control.helperText}
68+
aria-label={this.props.control.labelVisible ? null : this.props.control?.label?.text}
6869
/>
6970
<ValidationMessage inTable={this.props.tableControl} tableOnly state={this.props.state} messageInfo={this.props.messageInfo} />
7071
</div>);

canvas_modules/common-canvas/src/common-properties/controls/textarea/textarea.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class TextareaControl extends React.Component {
8181
hideLabel={this.props.tableControl}
8282
helperText={this.props.control.helperText}
8383
readOnly={this.props.readOnly}
84+
aria-label={this.props.control.labelVisible ? null : this.props.control?.label?.text}
8485
/>
8586
<ValidationMessage inTable={this.props.tableControl} tableOnly={!showValidationMessage} state={""} messageInfo={errorMessage} />
8687
</div>);
@@ -97,6 +98,7 @@ class TextareaControl extends React.Component {
9798
hideLabel={this.props.tableControl}
9899
helperText={this.props.control.helperText}
99100
readOnly={this.props.readOnly}
101+
aria-label={this.props.control.labelVisible ? null : this.props.control?.label?.text}
100102
/>
101103
);
102104
}

canvas_modules/common-canvas/src/common-properties/controls/textfield/textfield.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class TextfieldControl extends React.Component {
107107
value={value}
108108
labelText={this.props.controlItem}
109109
hideLabel={this.props.tableControl}
110+
aria-label={this.props.control.labelVisible ? null : this.props.control?.label?.text}
110111
ref={(ref) => (this.textInputRef = ref)}
111112
readOnly={this.props.readOnly}
112113
/>

0 commit comments

Comments
 (0)