Skip to content
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

feat(Popup): add closeOnClickInside support #2037

Closed

Conversation

cdaringe
Copy link
Contributor

@cdaringe cdaringe commented Sep 1, 2017

Fixes #2034.

problem statement

solution

@cdaringe cdaringe force-pushed the feat/popup-closeOnClickInside branch from e918581 to 7a4247a Compare September 1, 2017 05:05
</Popup>
)
assertInBody('.ui.popup.visible')
domEvent.click(document.getElementById('click-me'))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^ in manual tests, clicking this seems to work per expectation

@cdaringe cdaringe force-pushed the feat/popup-closeOnClickInside branch from 7a4247a to 2d12e09 Compare September 5, 2017 22:03
@codecov-io
Copy link

codecov-io commented Sep 5, 2017

Codecov Report

Merging #2037 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2037      +/-   ##
==========================================
+ Coverage   99.76%   99.76%   +<.01%     
==========================================
  Files         148      148              
  Lines        2561     2562       +1     
==========================================
+ Hits         2555     2556       +1     
  Misses          6        6
Impacted Files Coverage Δ
src/addons/Portal/Portal.js 100% <100%> (ø) ⬆️
src/modules/Popup/Popup.js 100% <100%> (ø) ⬆️
src/addons/TextArea/TextArea.js 100% <0%> (ø) ⬆️
src/behaviors/Visibility/Visibility.js 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 19e0056...df647e6. Read the comment docs.

@cdaringe cdaringe force-pushed the feat/popup-closeOnClickInside branch from 2d12e09 to e4c20b6 Compare September 5, 2017 22:24
@cdaringe
Copy link
Contributor Author

cdaringe commented Sep 5, 2017

woo hoo. test & linting fixed!

Copy link
Member

@layershifter layershifter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cdaringe Thanks for PR, I added some comments, but all of them about styling 👍


if (!closeOnPortalClick) return

debug('handlePortalClick()')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of our methods have debug() call first. I think that this can refactored to this:

handlePortalClick = (e) => {
  debug('handlePortalClick()')
  const { closeOnPortalClick } = this.props

  if (closeOnPortalClick) this.close(e)
}

@@ -247,7 +250,7 @@ export default class Popup extends Component {
getPortalProps() {
const portalProps = {}

const { on, hoverable } = this.props
const { on, hoverable, closeOnClickInside } = this.props
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's sort variables by name

@@ -270,6 +273,9 @@ export default class Popup extends Component {
portalProps.mouseLeaveDelay = 70
portalProps.mouseEnterDelay = 50
}
if (closeOnClickInside) {
portalProps.closeOnPortalClick = true
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be one-line:

if (closeOnClickInside) portalProps.closeOnPortalClick = true

@cdaringe
Copy link
Contributor Author

cdaringe commented Sep 9, 2017

formatting changes completed and pushed

@levithomason
Copy link
Member

Hey guys, quick question on naming here. After giving this a few days to sit and coming back to it, the closeOnClickInside and closeOnPortalClick strike me as not fitting with the rest of the library.

If a component supports a click event, it is usually just onClick. Do you agree or disagree that these should just be closeOnClick?

<Portal closeOnClick />

<Popup closeOnClick />

For the Portal on click seems to obviously apply to the portal. For the Popup it seems a click "inside" is a given. Am I over thinking this?

@levithomason
Copy link
Member

@layershifter / @cdaringe any thoughts on the above? If I don't hear back, I may go ahead with the rename at the next release (after today's release).

@cdaringe
Copy link
Contributor Author

cdaringe commented Sep 18, 2017 via email

@levithomason
Copy link
Member

In my mind, the fewer options the better :) Will close for now. Thanks for the work anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants