Skip to content

Commit

Permalink
Merge pull request #1571 from interface48/aria-describedby
Browse files Browse the repository at this point in the history
Adding support for aria-describedby attribute
  • Loading branch information
JedWatson authored Mar 30, 2017
2 parents 80943b4 + ba7dc9f commit a0e5855
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const Select = React.createClass({

propTypes: {
addLabelText: React.PropTypes.string, // placeholder displayed when you want to add a label on a multi-value input
'aria-describedby': React.PropTypes.string, // HTML ID(s) of element(s) that should be used to describe this input (for assistive tech)
'aria-label': React.PropTypes.string, // Aria label (for assistive tech)
'aria-labelledby': React.PropTypes.string, // HTML ID of an element that should be used as the label (for assistive tech)
arrowRenderer: React.PropTypes.func, // Create drop-down caret element
Expand Down Expand Up @@ -853,6 +854,7 @@ const Select = React.createClass({
'aria-owns': ariaOwns,
'aria-haspopup': '' + isOpen,
'aria-activedescendant': isOpen ? this._instancePrefix + '-option-' + focusedOptionIndex : this._instancePrefix + '-value',
'aria-describedby': this.props['aria-describedby'],
'aria-labelledby': this.props['aria-labelledby'],
'aria-label': this.props['aria-label'],
className: className,
Expand Down
13 changes: 13 additions & 0 deletions test/Select-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3803,6 +3803,19 @@ describe('Select', () => {
'to contain', <input role="combobox" aria-labelledby="test-label-id" />);
});

it('passes through the aria-describedby prop', () => {

instance = createControl({
options: defaultOptions,
value: 'one',
'aria-describedby': 'test-label1-id test-label2-id'
});

expect(instance,
'to contain', <input role="combobox" aria-describedby="test-label1-id test-label2-id" />);
});


it('passes through the aria-label prop', () => {

instance = createControl({
Expand Down

0 comments on commit a0e5855

Please sign in to comment.