Skip to content

Disable with not working on IE11 (W8.1) #355

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

Open
eloyesp opened this issue Dec 24, 2013 · 3 comments · May be fixed by #362
Open

Disable with not working on IE11 (W8.1) #355

eloyesp opened this issue Dec 24, 2013 · 3 comments · May be fixed by #362

Comments

@eloyesp
Copy link

eloyesp commented Dec 24, 2013

The issue is that "some times" (read ~= 1 of 20) clicks do disable the link, but do not navigate.
The link is disabled so the user cannot try again so it is very annoying.
It depends on the time you keep the mouse down and if you click over the text.
I also have a click sound being triggered and it also get triggered, but there is no navigation.
Does anyone have a clue?
The environment is IE11 on Windows 8.1 with Metro interface. (I don't like it but I didn't chose :) )

@eloyesp
Copy link
Author

eloyesp commented Dec 26, 2013

It seems to me that it is a bug in IE11, by now, I'm implementing a very simple workaround (easy to break) but it does work.

isIE11 = !!navigator.userAgent.match(/Trident\/7\.0/)

if isIE11
  $(document).on 'click', $.rails.linkClickSelector, (event) ->
    window.location.href = $(this).attr('href') unless event.defaultPrevented

I've also posted the issue in msdn.

And setup a fiddle to show the markup I'm using (but was not able to reproduce the bug there).

@pekeler
Copy link
Contributor

pekeler commented Mar 1, 2014

I can reproduce this issue every time when the link includes a block element:

<%= link_to some_path, :data => {:disable_with => 'Please wait...'} do %>
  <div>click</div>
<% end %>

Breaks in older IE versions, too.
Breaking test case: http://jsfiddle.net/FcXL8/4/embedded/result/
With @eloyesp 's workaround: http://jsfiddle.net/FcXL8/6/embedded/result/

@trimentor
Copy link

trimentor commented May 30, 2016

I can also reproduce this bug in IE11 and Edge (v. 25.10586.0.0)

Like @pekeler I am using the link_to helper with a block.
As long as you click on the link element itself everything works.
From the moment you click on any child nodes the link gets disabled, but nothing more.

How to fix this issue:

You need to set data-method="get"on the link to make it work.
This is because the handleMethod in jQuery UJS will submit a hidden (newly created) form for non-remote links to simulate the original link behavior.

@pekeler The following code should work:

<%= link_to some_path, data: {disable_with: 'Please wait...', method: :get} do %>
  <div>click</div>
<% end %>

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 a pull request may close this issue.

3 participants