[Libreoffice-commits] .: bug/bug

Loic Dachary loic at kemper.freedesktop.org
Thu Sep 22 10:38:28 PDT 2011


 bug/bug/bug.js |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit 14ffc3a998cb587a3a19394082c19b21c13ab7f6
Author: Loic Dachary <loic at dachary.org>
Date:   Thu Sep 22 19:38:06 2011 +0200

    ie specific code to disable the text part of the input[type=file]
    http://stackoverflow.com/questions/3914142/file-input-behaviour-in-ie
    explains it in more words:
    
    I have noticed a difference in behaviour between chrome and IE of handling file input clicks.
    
    In Chrome, clicking anywhere on the input (text or button bit) triggers the file dialogue.
    
    In IE (testing on 7), you have to click on the actual button, not the text bit.
    
    The problem is that I'm using a transparent file input on top of a regular text box. Clicking on the text box should open the dialog. In Chrome this is working fine, as the total size of the input is the same size as my text box.
    
    In IE it doesn't work properly as the user needs to be clicking on the actual button part of the transparent file input.
    
    Any ideas of how to fix this??

diff --git a/bug/bug/bug.js b/bug/bug/bug.js
index c116a3c..f997a47 100644
--- a/bug/bug/bug.js
+++ b/bug/bug/bug.js
@@ -229,6 +229,14 @@
                     show();
                 
             }});
+            if($.browser.ie) {
+                // ie allow the input field to get focus, presumably to 
+                // type the filename. launch the browser instead.
+                $("input[type='file']", element).focus(function() {
+                    $(this).click();
+                    $(this).blur(); // loose focus so that no caret is shown even when in caret browsing
+                });
+            }
             $("input[type='file']", element).change(function() {
                 $("input[type='text']", element).val($(this).val());
             });


More information about the Libreoffice-commits mailing list