[ 2 posts ]

Khoa Bui

  • Username: khoaminhbui
  • Joined: Tue Aug 09, 2011 6:11 am
  • Posts: 127
  • Location: Vietnam
  • Twitter: khoaminhbui
  • IRC: k_bui
  • Offline
  • Profile

Cross browser event simulation bug (on Firefox).

Post Posted: Sat Jul 14, 2012 12:52 am
+0-
I had a problem using event simulation on Firefox, although it works fine on Chrome and Safari.

The scenario is that: There is a 'Select File' button, and a hidden input[type='file'] control. Once the button is clicked, the 'click' event is simulated on input[type='file'] control, the open file dialog appear.

On Firefox, the open file dialog does not appear.

Please see the example on jsFiddle:
http://jsfiddle.net/khoaminhbui/bayrc/

Marco Asbreuk

YUI Contributor

  • Username: itsasbreuk
  • Joined: Mon Nov 16, 2009 5:14 am
  • Posts: 485
  • Location: Netherlands
  • Twitter: itsasbreuk
  • GitHub: ItsAsbreuk
  • Gists: ItsAsbreuk
  • IRC: Marco Asbreuk
  • Offline
  • Profile

Re: Cross browser event simulation bug (on Firefox).

Post Posted: Sat Jul 14, 2012 1:22 am
+0-
Hey Khoa,

I'm not sure if it's a bug. You should be careful when simulating actions that normally would be done by userinteraction. I think firefox doesn't allow you to do that.

But I'm not sure.
More about this: http://yuilibrary.com/yui/docs/event/simulate.html#faking

I suggest you make a function (or a widget that shows up) that uses 'Uploader'. Nice is to descent Y.panel and create your own uploader. Both the form as well as your simulation could show this widget, select a file and insert the response int your inputnode. (for progressive enhancement, you could use the upload-button in the original way, and have javascript add a e.preventdefault to it)

Kind Regards,
Marco.
  [ 2 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum