angular-material-keyboard icon indicating copy to clipboard operation
angular-material-keyboard copied to clipboard

Keyboard disappears when clicking a key

Open daweedm opened this issue 7 years ago • 4 comments

Hello,

First of all, thanks for your work !

I'm facing an issue (using ionic 1.3.1, angular 1.5.3, ngAnimate 1.5.3, ngAria 1.5.3 and the latest version of your plugin and Google Chrome)

The keyboard directly disappears when I click on whatever button present on it. But it keep itself visible when I click on a key then drag the mouse out of the pressed key. It seems that when the event "mousedown" is sent to a key of the keyboard, it close automatically.

How can I solve this problem ?

Regards, David

daweedm avatar May 15 '17 03:05 daweedm

There's probably an issue with the focus / blur events. I never tested it with AngularJS after 1.4. And since I started working on a complete rework for Angular 4 I have no time to test it appropriate.

So pull requests are very welcome :)

davidenke avatar May 15 '17 21:05 davidenke

Ok ! thanks for your quick response :) If I find a solution I will make a PR

daweedm avatar May 16 '17 21:05 daweedm

Hello daweedm, I am experiencing the same issue using it with ionic. Please did you find any solution to this issue? Thanks.

oroc avatar Aug 29 '17 17:08 oroc

Hey I found a solution. I declaratively refocus the element in my controller using ng-change to trigger a function whenever any key is pressed.

--VIEW <input type="text" use-keyboard="Deutsch" ng-model="myModel" id="myInput" ng-change="refocus()">

//--CONTROLLER .controller("MyCtrl",["$scope", "focus", function(){ $scope. refocus = function() { $timeout(function() {focus('myInput');}); }])

//--SERVICE .factory('focus', function($timeout, $window) { return function(id) { // timeout makes sure that is invoked after any other event has been triggered. // e.g. click events that need to run before the focus or // inputs elements that are in a disabled state but are enabled when those events // are triggered. $timeout(function() { var element = $window.document.getElementById(id); if(element) element.focus(); }); }; })

oroc avatar Aug 29 '17 18:08 oroc