Skip to content

Commit f9d4f68

Browse files
committed
fix button scroll
1 parent 89c0dfb commit f9d4f68

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rc-drawer-menu",
3-
"version": "0.3.1",
3+
"version": "0.3.2",
44
"description": "drawer menu animation component for react",
55
"keywords": [
66
"react",

src/Drawer.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,19 @@ class Drawer extends React.PureComponent {
153153
return doms[doms.length - 1];
154154
}
155155

156+
getIsButtonDom = (dom) => {
157+
if (dom.className === `${this.props.className}-button`) {
158+
return true;
159+
}
160+
if (dom.parentNode) {
161+
return this.getIsButtonDom(dom.parentNode);
162+
}
163+
return false;
164+
}
165+
156166
removeScroll = (e) => {
157167
const dom = e.target;
158-
if (dom.className === `${this.props.className}-bg`) {
168+
if (dom.className === `${this.props.className}-bg` || this.getIsButtonDom(dom)) {
159169
e.preventDefault();
160170
e.returnValue = false;
161171
return;

0 commit comments

Comments
 (0)