Commit 0dece7a7 authored by Marcel Korpel's avatar Marcel Korpel
Browse files

Set focus back to input field after clicking an item

Test 'focus is still set' added

Fixes issue #5933
parent 3b3dd3ac
4 merge requests!6821Typeahead updater,!6666Patch 1,!6610Add outline for input[type="image"],!6099Set focus back after clicking typeahead menu
Showing with 6 additions and 0 deletions
+6 -0
......@@ -263,6 +263,7 @@
e.stopPropagation()
e.preventDefault()
this.select()
this.$element.focus()
}
, mouseenter: function (e) {
......
......@@ -162,17 +162,22 @@ $(function () {
})
, typeahead = $input.data('typeahead')
, changed = false
, focus = false
, blur = false
$input.val('a')
typeahead.lookup()
$input.change(function() { changed = true });
$input.focus(function() { focus = true; blur = false });
$input.blur(function() { blur = true; focus = false });
$(typeahead.$menu.find('li')[2]).mouseover().click()
equals($input.val(), 'ac', 'input value was correctly set')
ok(!typeahead.$menu.is(':visible'), 'the menu was hidden')
ok(changed, 'a change event was fired')
ok(focus && !blur, 'focus is still set')
typeahead.$menu.remove()
})
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment