-
Notifications
You must be signed in to change notification settings - Fork 813
enable click to close in iOS (#301) #304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -153,29 +153,14 @@ export default class ModalPortal extends Component { | |
} | ||
} | ||
|
||
handleOverlayMouseDown = () => { | ||
if (this.shouldClose === null) { | ||
this.shouldClose = true; | ||
} | ||
} | ||
|
||
handleOverlayMouseUp = (event) => { | ||
if (this.shouldClose && this.props.shouldCloseOnOverlayClick) { | ||
if (this.ownerHandlesClose()) { | ||
this.requestClose(event); | ||
} else { | ||
this.focusContent(); | ||
} | ||
handleOverlayClick(event) { | ||
if (this.props.shouldCloseOnOverlayClick && this.ownerHandlesClose()) { | ||
this.requestClose(event); | ||
} | ||
this.shouldClose = null; | ||
} | ||
|
||
handleContentMouseDown = () => { | ||
this.shouldClose = false; | ||
} | ||
|
||
handleContentMouseUp = () => { | ||
this.shouldClose = false; | ||
handleContentClick(event) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also... Lint:
Hope this one is correct. |
||
event.stopPropagation(); | ||
} | ||
|
||
requestClose (event) { | ||
|
@@ -217,17 +202,15 @@ export default class ModalPortal extends Component { | |
ref={(c) => { this.overlay = c; }} | ||
className={this.buildClassName('overlay', this.props.overlayClassName)} | ||
style={Assign({}, overlayStyles, this.props.style.overlay || {})} | ||
onMouseDown={this.handleOverlayMouseDown} | ||
onMouseUp={this.handleOverlayMouseUp} | ||
onClick={this.handleOverlayClick} | ||
> | ||
<div | ||
ref={(c) => { this.content = c; }} | ||
style={Assign({}, contentStyles, this.props.style.content || {})} | ||
className={this.buildClassName('content', this.props.className)} | ||
tabIndex={-1} | ||
onKeyDown={this.handleKeyDown} | ||
onMouseDown={this.handleContentMouseDown} | ||
onMouseUp={this.handleContentMouseUp} | ||
onClick={this.handleContentClick} | ||
role={this.props.role} | ||
aria-label={this.props.contentLabel} | ||
> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint:
handleOverlayClick (event)
.