Skip to content

Commit 36e3e55

Browse files
committed
[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
1 parent 8f7cf67 commit 36e3e55

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/components/TrayPortal.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ export default React.createClass({
105105
this.refs.content.focus();
106106
},
107107

108-
toggleAriaHidden(element) {
109-
if (!element.getAttribute('aria-hidden')) {
110-
element.setAttribute('aria-hidden', true);
111-
} else {
112-
element.removeAttribute('aria-hidden');
113-
}
108+
applyAriaHidden(element) {
109+
element.setAttribute('aria-hidden', true);
110+
},
111+
112+
removeAriaHidden(element) {
113+
element.removeAttribute('aria-hidden');
114114
},
115115

116116
handleOverlayClick(e) {
@@ -148,7 +148,7 @@ export default React.createClass({
148148
this.props.onOpen();
149149
}
150150
if (this.props.getAriaHideElement) {
151-
this.toggleAriaHidden(this.props.getAriaHideElement());
151+
this.applyAriaHidden(this.props.getAriaHideElement());
152152
}
153153
this.setState({afterOpen: true});
154154
});
@@ -161,7 +161,7 @@ export default React.createClass({
161161
this.closeWithoutTimeout();
162162
}
163163
if (this.props.getAriaHideElement) {
164-
this.toggleAriaHidden(this.props.getAriaHideElement());
164+
this.removeAriaHidden(this.props.getAriaHideElement());
165165
}
166166
},
167167

0 commit comments

Comments
 (0)