Skip to content

Commit

Permalink
restore focus if chosen was activated
Browse files Browse the repository at this point in the history
fixes #2429
  • Loading branch information
koenpunt committed Oct 1, 2016
1 parent 439a711 commit 16e134d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion coffee/chosen.jquery.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ class Chosen extends AbstractChosen

choice_destroy: (link) ->
if this.result_deselect( link[0].getAttribute("data-option-array-index") )
this.show_search_field_default()
if @active_field
@search_field.focus()
else
this.show_search_field_default()

this.results_hide() if @is_multiple and this.choices_count() > 0 and @search_field.val().length < 1

Expand Down
5 changes: 4 additions & 1 deletion coffee/chosen.proto.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,10 @@ class @Chosen extends AbstractChosen

choice_destroy: (link) ->
if this.result_deselect link.readAttribute("rel")
this.show_search_field_default()
if @active_field
@search_field.focus()
else
this.show_search_field_default()

this.results_hide() if @is_multiple and this.choices_count() > 0 and @search_field.value.length < 1

Expand Down

0 comments on commit 16e134d

Please # to comment.