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

Use preventDefault in _onExpandable handler. Fixes #2484 #2495

Merged
merged 1 commit into from Dec 13, 2015

Conversation

neverfox
Copy link
Contributor

On some touch devices and in certain contexts, a touch event can trigger a second mouse event, causing expandable cards to close as soon as they open. Follows advice from http://www.html5rocks.com/en/mobile/touchandmouse/ to "use preventDefault() inside touch event handlers, so the default mouse-emulation handling doesn’t occur." Even though this can prevent "other default browser behavior (like scrolling)", this shouldn't be a danger in the specific context of this handler.

@@ -22,7 +22,8 @@ const Card = React.createClass({
style: React.PropTypes.object,
},

_onExpandable() {
_onExpandable(e) {
e.preventDefault();
Copy link
Member

Choose a reason for hiding this comment

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

Can we call it event? I think that it's better to be explicit.

@oliviertassinari
Copy link
Member

@neverfox That sounds like an excellent idea.

On some touch devices and in certain contexts, a touch event can trigger a second mouse event, causing expandable cards to close as soon as they open. Follows advice from http://www.html5rocks.com/en/mobile/touchandmouse/ to "use preventDefault() inside touch event handlers, so the default mouse-emulation handling doesn’t occur." Even though this can prevent "other default browser behavior (like scrolling)", this shouldn't be a danger in the specific context of this handler.

Rename e to event in _onExpandable
@neverfox neverfox force-pushed the pull-request/card-prevent-default branch from 87b6f0b to 9bb9819 Compare December 13, 2015 17:04
@neverfox
Copy link
Contributor Author

@oliviertassinari Done!

@alitaheri
Copy link
Member

@neverfox Thanks a lot 👍 👍

alitaheri added a commit that referenced this pull request Dec 13, 2015
Use preventDefault in _onExpandable handler. Fixes #2484
@alitaheri alitaheri merged commit 29e5791 into mui:master Dec 13, 2015
@neverfox neverfox deleted the pull-request/card-prevent-default branch December 13, 2015 19:05
@zannager zannager added the docs Improvements or additions to the documentation label Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants