Skip to content
This repository was archived by the owner on May 4, 2019. It is now read-only.

Commit df7bbd7

Browse files
committed
fix(dropdown): drop downs tablable and readable when disabled
1 parent 0b83efd commit df7bbd7

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/Assets/Styles/accessibility.less

+6
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,9 @@
6161
.readonly-select {
6262
user-select: all;
6363
}
64+
65+
.disabled {
66+
background: rgb(128, 128, 128);
67+
background: rgba(128, 128, 128, 0.4);
68+
pointer-events: none;
69+
}

src/DropDown/DropDown.tsx

+9-4
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,22 @@ export class Dropdown extends React.Component<DropdownProps, {}> {
4848
const classes = "accessibility-dropdown form-group ".concat(
4949
this.props.disabled ? "selection-disabled" : "selection-enabled"
5050
);
51-
const options = this.props.selections.map(this.renderOption);
51+
const options = this.props.disabled
52+
? []
53+
: this.props.selections.map(this.renderOption);
54+
const disableClass = this.props.disabled ? "disabled" : "";
55+
const ariaLabel = this.props.disabled
56+
? `${this.props.label} unavailable`
57+
: "";
5258

5359
return (
5460
<div className={classes}>
5561
<label htmlFor={this.props.resourceCode}> {this.props.label}</label>
5662
<br />
5763
<select
58-
className="form-control"
64+
className={`form-control ${disableClass}`}
5965
id={this.props.resourceCode}
60-
disabled={this.props.disabled}
61-
aria-hidden={this.props.disabled}
66+
aria-label={ariaLabel}
6267
onChange={this.onChange}
6368
value={this.props.selectionCode}
6469
>

0 commit comments

Comments
 (0)