Skip to content

Commit

Permalink
Fixed #855 - Added ariaLabel and ariaLabelledBy properties to DropDown
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Apr 22, 2019
1 parent 7cdca99 commit 66f1761
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export class Dropdown extends Component {
showClear: false,
tooltip: null,
tooltipOptions: null,
ariaLabel: null,
ariaLabelledBy: null,
onChange: null,
onMouseDown: null,
onContextMenu: null
Expand Down Expand Up @@ -65,6 +67,8 @@ export class Dropdown extends Component {
showClear: PropTypes.bool,
tooltip: PropTypes.string,
tooltipOptions: PropTypes.object,
ariaLabel: PropTypes.string,
ariaLabelledBy: PropTypes.string,
onChange: PropTypes.func,
onMouseDown: PropTypes.func,
onContextMenu: PropTypes.func
Expand Down Expand Up @@ -501,7 +505,7 @@ export class Dropdown extends Component {
return <div className="p-hidden-accessible">
<input ref={(el) => this.focusInput = el} id={this.props.inputId} type="text" role="listbox"
onFocus={this.onInputFocus} onBlur={this.onInputBlur} onKeyDown={this.onInputKeyDown}
disabled={this.props.disabled} tabIndex={this.props.tabIndex} />
disabled={this.props.disabled} tabIndex={this.props.tabIndex} aria-label={this.props.ariaLabel} aria-labelledby={this.props.ariaLabelledBy} />
</div>;
}

Expand All @@ -510,7 +514,7 @@ export class Dropdown extends Component {
let value = label||this.props.value||'';

return <input ref={(el) => this.editableInput = el} type="text" defaultValue={value} className="p-dropdown-label p-inputtext" disabled={this.props.disabled} placeholder={this.props.placeholder}
onClick={this.onEditableInputClick} onInput={this.onEditableInputChange} onFocus={this.onEditableInputFocus} onBlur={this.onInputBlur} />;
onClick={this.onEditableInputClick} onInput={this.onEditableInputChange} onFocus={this.onEditableInputFocus} onBlur={this.onInputBlur} aria-label={this.props.ariaLabel} aria-labelledby={this.props.ariaLabelledBy}/>;
}
else {
let className = classNames('p-dropdown-label p-inputtext', {
Expand Down

0 comments on commit 66f1761

Please sign in to comment.