Ionic bug: Ion-content is not able to scroll back again after multiple input was focused


Let’s say there are a list of input fields. I define the keyboard “Go” button to act as “Next” by using element.focus() (assume element is an input, element.focus() is used in a directive). When I hit the “Go” button, the view will scroll down correspondingly. But after the view moves down further and further. The view is not able to scroll back.

For example:
From the first input, just hit keyboard “Go”

Continue hitting “Go”

Continue hitting “Go”, now the focused input is the last one in current view.

Then hit “Go” once again, here, the issue happens. I cannot scroll up the view

Also, the bottom appears a large blank field.

For the code, it’s like:


<form enter-as-tab> <input ...> <input ...> <input ...> <input ...> .... </form>


.directive('enterAsTab', function () { return { restrict: "A", link: function (scope, element) { console.log("loaded directive enter-as-tab"); element.on("keydown", "input", function (event) { var code = event.keyCode || event.which; var inputs = element.find('input'); var currInput = inputs.eq(inputs.index(this)) var nextInput = inputs.eq(inputs.index(this) + 1); if (code === 13) { event.preventDefault(); currInput.blur(); if (nextInput.length > 0) nextInput.focus(); } }); } } })