Skip to content

Commit

Permalink
Refactor #933 - Fixed IE11 issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Jun 20, 2019
1 parent 601becb commit 64a2b6f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/components/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,12 +519,13 @@ export class Dropdown extends Component {
}

renderHiddenSelect(selectedOption) {
let value = selectedOption ? selectedOption.value : null;
let option = selectedOption ? <option value={value}>{this.getOptionLabel(selectedOption)}</option> : null;
let placeHolderOption = <option value="">{this.props.placeholder}</option>;
let option = selectedOption ? <option value={selectedOption.value}>{this.getOptionLabel(selectedOption)}</option> : null;

return (
<div className="p-hidden-accessible p-dropdown-hidden-select">
<select defaultValue={value} required={this.props.required} tabIndex="-1" aria-hidden="true">
<select ref={(el) => this.nativeSelect = el} required={this.props.required} tabIndex="-1" aria-hidden="true">
{placeHolderOption}
{option}
</select>
</div>
Expand Down Expand Up @@ -628,6 +629,8 @@ export class Dropdown extends Component {
if (this.props.tooltip) {
this.renderTooltip();
}

this.nativeSelect.selectedIndex = 1;
}

componentWillUnmount() {
Expand Down Expand Up @@ -662,6 +665,8 @@ export class Dropdown extends Component {
else
this.renderTooltip();
}

this.nativeSelect.selectedIndex = 1;
}

renderTooltip() {
Expand Down

0 comments on commit 64a2b6f

Please sign in to comment.