Keyboard icon indicating copy to clipboard operation
Keyboard copied to clipboard

Multiple inputs in IE11

Open checkin247 opened this issue 8 years ago • 11 comments

Running your fiddle for multiple inputs in IE11, one has to click (touch) a second time the input field to get the keyboard (while swiching the input fields, not the first focus).

It's the multiple inputs fiddle in your How-to in your wiki (https://jsfiddle.net/Mottie/9t1nrrbh/) Seems like a bug in IE11 (only tested on IE "11", works great in other browsers). Workaround is to give focus on click event (https://jsfiddle.net/9t1nrrbh/9/)

Hope this is the right place to report. BR

checkin247 avatar Mar 27 '17 14:03 checkin247

Hi @checkin247!

Thanks for reporting this problem and providing a work around! I'll investigate.

Mottie avatar Mar 27 '17 18:03 Mottie

@Mottie is this bug solved yet?

for those of you who use angular put this directive on your element:

angular.module('focus-input', [])
    .directive('focusInput', focusInputDirective);

function focusInputDirective() {
    return {
        restrict: "A",
        link: linkFn
    };

    function linkFn(scope, elem, attrs) {
        debugger;
        elem.on("click", setFocus);

        function setFocus() {
            elem.focus();
        }

        scope.$on("$destroy", function () {
            elem.off("click", setFocus);
        })
    }
}

hdi-amiri avatar Jul 09 '17 14:07 hdi-amiri

Hi @ha0x7c7!

Sorry, I've been too distracted/busy to look into this further. I'll try to find some time this week.

Mottie avatar Jul 09 '17 16:07 Mottie

@Mottie any update on this?

hdi-amiri avatar Aug 08 '17 07:08 hdi-amiri

Sorry no, not yet 😞

Mottie avatar Aug 08 '17 12:08 Mottie

how should we tackle this problem? I would like to help if I know where to start !

hdi-amiri avatar Aug 08 '17 15:08 hdi-amiri

I just modified and tried the demo again (in IE11 of course)... clicking on the input appears to focus and open the keyboard without any problems.

I actually wonder if the code at line 718 (the blur) is causing the problem:

base.bindFocus = function() {
  if (o.openOn) {
    // make sure keyboard isn't destroyed
    // Check if base exists, this is a case when destroy is called, before timers have fired
    if (base && base.el.active) {
      base.$el.bind(o.openOn + base.namespace, function() {
        base.focusOn();
      });
      // remove focus from element (needed for IE since blur doesn't seem to work)
      if ($(":focus")[0] === base.el) {
        base.$el.blur();
      }
    }
  }
};

Would you be willing to test it with this line removed?... since I can't reproduce the problem.

Mottie avatar Aug 08 '17 15:08 Mottie

@Mottie Yes with pleasure (I will check it tomorrow ) ! I only remove that if clause? so what is the replacement for this? what does that comment says though?

hdi-amiri avatar Aug 08 '17 19:08 hdi-amiri

If I remember correctly, IE used to maintain focus on the original input even after the keyboard opened and focus was supposed to be on the preview... remove that line and you should not need to replace it with anything.

Mottie avatar Aug 08 '17 19:08 Mottie

Did removing that code fix the problem?

Mottie avatar Aug 18 '17 02:08 Mottie

Sorry man for being late, we have released a major version to production and the code should kind of be untouched! maybe in next patch I will have a look at it.

On Fri, Aug 18, 2017 at 7:10 AM, Rob Garrison [email protected] wrote:

Did removing that code fix the problem?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Mottie/Keyboard/issues/541#issuecomment-323244580, or mute the thread https://github.com/notifications/unsubscribe-auth/AKYCFxTB55KjJ8sJweBfuCyiBrXlN5Lcks5sZPmVgaJpZM4MqUyA .

hdi-amiri avatar Aug 18 '17 09:08 hdi-amiri