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

fix(Popup|Portal): do not close when mouse click was occurred inside #3575

Merged
merged 8 commits into from
May 5, 2019

Conversation

mihai-dinculescu
Copy link
Member

@mihai-dinculescu mihai-dinculescu commented Apr 18, 2019

This PR is my proposed fix for #3554.

Afaik the onClick event provides no information whatsoever about the position where the mouse button was pressed down. For this reason I've added a listener for mouseDown and I'm storing the latest occurence of this event in the component.

I would like to also write a unit test but I'm not really sure how to go about mocking a click that originates in one place and ends in another.

@mihai-dinculescu
Copy link
Member Author

mihai-dinculescu commented Apr 25, 2019

I've updated domEvent.click to also fire mousedown and mouseup so that it mimicks reality.

@codecov-io
Copy link

codecov-io commented Apr 25, 2019

Codecov Report

Merging #3575 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3575      +/-   ##
==========================================
- Coverage   99.81%   99.81%   -0.01%     
==========================================
  Files         174      174              
  Lines        2734     2733       -1     
==========================================
- Hits         2729     2728       -1     
  Misses          5        5
Impacted Files Coverage Δ
src/addons/Portal/Portal.js 100% <100%> (ø) ⬆️
src/collections/Table/Table.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 c9a3418...25ca6ac. Read the comment docs.

@layershifter
Copy link
Member

@joergbaier @mihai-dinculescu Thank you for addressing this 👍

We have a similar stuff in Dropdown with isMouseDown and I prefer to keep existing listeners with click instead of mouseup. So I am wondered, do we really need to use document.mouseup instead of document.click?

@mihai-dinculescu
Copy link
Member Author

mihai-dinculescu commented Apr 25, 2019

I don't see any way around using mousedown. click provides no information whatsoever about it.

However, I do see why we need to be more thoughtful before merging this. Touch gestures do not provide mousedown and mouseup events.

After further consideration, I now think that we should use mousedown in tandem with click, instead of mousedown and mouseup.

I should have a rework of this branch ready soon.

@mihai-dinculescu
Copy link
Member Author

Ok @layershifter, it should look much better now!

@layershifter layershifter changed the title fix(Popup/Portal): closed while "mouse click inside but release outside" of the Popup block fix(Popup|Portal): do not close when mouse click was occurred inside May 5, 2019
@layershifter layershifter merged commit d6751d0 into Semantic-Org:master May 5, 2019
mbakiev pushed a commit to mbakiev/Semantic-UI-React that referenced this pull request Jun 17, 2019
…emantic-Org#3575)

* Fix

* Rework.

* Rework of rework.

* Fix typo.

* fix path to PopupOffsetExample

* fix path to PopupExampleHideOnScroll

* naming update, set `null` instead of `delete`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants