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

Collapse should use touchstart event on touch devices #13036

Closed
romancieslik opened this issue Mar 12, 2014 · 13 comments
Closed

Collapse should use touchstart event on touch devices #13036

romancieslik opened this issue Mar 12, 2014 · 13 comments
Labels

Comments

@romancieslik
Copy link

When collapsing the navbar-collapse, it takes around 1 second for the menu to respond to the event. Changing the event from

click.bs.collapse.data-api

to

touchstart.bs.collapse.data-api

solved this for us. The menu reacts almost instantly then.

Do you plan to make this event configurable?

@cvrebert cvrebert added the js label Mar 12, 2014
@cvrebert
Copy link
Collaborator

When collapsing the navbar-collapse, it takes around 1 second for the menu to respond to the event.

On what browser & OS?

If this is on a touch device, have you checked whether :hover styles might be the culprit for the delay?

@romancieslik
Copy link
Author

It is on Chrome (iOS and Android) and Mobile Safari.
The :hover styles do not have any effect on this.

@cvrebert
Copy link
Collaborator

@romancieslik
Copy link
Author

Nope, as it is the same issue in Safari and Chrome on iOS

@cvrebert
Copy link
Collaborator

@romancieslik AFAIK, that doesn't have any bearing on my previous question.
(Also, you're aware that Chrome on iOS is basically the same as Safari as far as the rendering & JS engines go, right?)

@romancieslik
Copy link
Author

Oops, to answer your question: The issue persist on Android’s latest Chrome.
(Yep, I'm aware there’s no real Chrome on iOS.)

@zlatanvasovic
Copy link
Contributor

touchstart.bs.collapse.data-api will slow down the response on the desktop.

We have to test the touch support first, then change it.

@romancieslik
Copy link
Author

Great. Looking forward to your investigation results.

@zlatanvasovic
Copy link
Contributor

There isn't the right way for the touch support detection. We can implement the current one that Modernizr have.

We have to do:

// some way to check touch support
// ...

if (touchsupport) {
  event = touchstart.bs.collapse.data-api
}
else {
  event = click.bs.collapse.data-api
}

I don't have any other ideas.

@romancieslik
Copy link
Author

Sounds like a workaround, but good enough for our purposes.

@hnrch02
Copy link
Collaborator

hnrch02 commented Sep 10, 2014

I can't reproduce on getbootstrap.com using iOS 7.1.2's Safari. Tried it using this JS Bin which uses the touchstart event instead of the click event and it is indeed faster.

@mdo @fat Should we do something about this? Maybe punt to v4?

@fat
Copy link
Member

fat commented Oct 3, 2014

Yeah touch start is definitely faster.

I'd like to rethink a lot of our components for mobile in v4. This would be a good candidate for that imho

@mdo
Copy link
Member

mdo commented Oct 3, 2014

Punting to v4.

@mdo mdo closed this as completed Oct 3, 2014
@cvrebert cvrebert changed the title Configure event for Collapse Collapse should use touchstart event on touch devices Oct 3, 2014
@mdo mdo mentioned this issue Aug 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants