Skip to content

Commit

Permalink
[fixed] Split toggleAriaHidden internal method to two methods
Browse files Browse the repository at this point in the history
This change makes things much more reliable overall by preventing
some cross-browser concerns where the method ended up being
triggered more than once causing it to reverse from the expected
behavior
  • Loading branch information
claydiffrient committed Jul 13, 2016
1 parent 8f7cf67 commit 36e3e55
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/components/TrayPortal.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ export default React.createClass({
this.refs.content.focus();
},

toggleAriaHidden(element) {
if (!element.getAttribute('aria-hidden')) {
element.setAttribute('aria-hidden', true);
} else {
element.removeAttribute('aria-hidden');
}
applyAriaHidden(element) {
element.setAttribute('aria-hidden', true);
},

removeAriaHidden(element) {
element.removeAttribute('aria-hidden');
},

handleOverlayClick(e) {
Expand Down Expand Up @@ -148,7 +148,7 @@ export default React.createClass({
this.props.onOpen();
}
if (this.props.getAriaHideElement) {
this.toggleAriaHidden(this.props.getAriaHideElement());
this.applyAriaHidden(this.props.getAriaHideElement());
}
this.setState({afterOpen: true});
});
Expand All @@ -161,7 +161,7 @@ export default React.createClass({
this.closeWithoutTimeout();
}
if (this.props.getAriaHideElement) {
this.toggleAriaHidden(this.props.getAriaHideElement());
this.removeAriaHidden(this.props.getAriaHideElement());
}
},

Expand Down

0 comments on commit 36e3e55

Please sign in to comment.