From 36e3e55b5ed6aa8e0fc7c9160c4c05cddf472e44 Mon Sep 17 00:00:00 2001 From: Clay Diffrient Date: Wed, 13 Jul 2016 16:50:52 -0600 Subject: [PATCH] [fixed] Split toggleAriaHidden internal method to two methods 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 --- lib/components/TrayPortal.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/components/TrayPortal.js b/lib/components/TrayPortal.js index 317ec42..742dfcf 100644 --- a/lib/components/TrayPortal.js +++ b/lib/components/TrayPortal.js @@ -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) { @@ -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}); }); @@ -161,7 +161,7 @@ export default React.createClass({ this.closeWithoutTimeout(); } if (this.props.getAriaHideElement) { - this.toggleAriaHidden(this.props.getAriaHideElement()); + this.removeAriaHidden(this.props.getAriaHideElement()); } },