Skip to content

Commit

Permalink
Merge pull request #43 from juanolalla/aria-expanded
Browse files Browse the repository at this point in the history
Fix search field announced as expanded on focus
  • Loading branch information
JJJ authored Oct 28, 2022
2 parents fc9274f + 957a1a0 commit 4afd715
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 12 deletions.
3 changes: 2 additions & 1 deletion coffee/chosen.jquery.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ class Chosen extends AbstractChosen
@active_field = true

@search_field.val(@search_field.val())
@search_field.attr("aria-expanded",true);
this.search_results.attr("aria-busy", false);
@search_field.trigger "focus"

Expand Down Expand Up @@ -295,6 +294,7 @@ class Chosen extends AbstractChosen
@container.addClass "chosen-with-drop"
@results_showing = true

@search_field.attr("aria-expanded", true)
@search_field.trigger "focus"
@search_field.val this.get_search_field_value()

Expand All @@ -315,6 +315,7 @@ class Chosen extends AbstractChosen
@container.removeClass "chosen-dropup"
@form_field_jq.trigger("chosen:hiding_dropdown", {chosen: this})

@search_field.attr("aria-expanded", false)
@results_showing = false


Expand Down
3 changes: 2 additions & 1 deletion coffee/chosen.proto.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ class @Chosen extends AbstractChosen
@active_field = true

@search_field.value = this.get_search_field_value()
@search_field.writeAttribute("aria-expanded", "true")
this.search_results.writeAttribute("aria-busy", "false")
@search_field.focus()

Expand Down Expand Up @@ -299,6 +298,7 @@ class @Chosen extends AbstractChosen
@container.addClassName "chosen-with-drop"
@results_showing = true

@search_field.writeAttribute("aria-expanded", "true")
@search_field.focus()
@search_field.value = this.get_search_field_value()

Expand All @@ -319,6 +319,7 @@ class @Chosen extends AbstractChosen
@container.removeClassName "chosen-dropup"
@form_field.fire("chosen:hiding_dropdown", {chosen: this})

@search_field.writeAttribute("aria-expanded", "false")
@results_showing = false


Expand Down
2 changes: 1 addition & 1 deletion docs/chosen.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Chosen, a Select Box Enhancer for jQuery and Prototype
Version 2.2.1
Full source at https://github.com/jjj/chosen
Copyright (c) 2011-2021 JJJ
Copyright (c) 2011-2022 JJJ
MIT License, https://github.com/jjj/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
*/
Expand Down
5 changes: 3 additions & 2 deletions docs/chosen.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Chosen, a Select Box Enhancer for jQuery and Prototype
Version 2.2.1
Full source at https://github.com/jjj/chosen
Copyright (c) 2011-2021 JJJ
Copyright (c) 2011-2022 JJJ
MIT License, https://github.com/jjj/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
*/
Expand Down Expand Up @@ -1271,7 +1271,6 @@ This file is generated by `grunt build`, do not edit it by hand.
}
this.active_field = true;
this.search_field.val(this.search_field.val());
this.search_field.attr("aria-expanded", true);
this.search_results.attr("aria-busy", false);
return this.search_field.trigger("focus");
}
Expand Down Expand Up @@ -1350,6 +1349,7 @@ This file is generated by `grunt build`, do not edit it by hand.
}
this.container.addClass("chosen-with-drop");
this.results_showing = true;
this.search_field.attr("aria-expanded", true);
this.search_field.trigger("focus");
this.search_field.val(this.get_search_field_value());
this.winnow_results();
Expand Down Expand Up @@ -1378,6 +1378,7 @@ This file is generated by `grunt build`, do not edit it by hand.
chosen: this
});
}
this.search_field.attr("aria-expanded", false);
return this.results_showing = false;
}

Expand Down
4 changes: 2 additions & 2 deletions docs/chosen.jquery.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/chosen.min.css

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions docs/chosen.proto.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Chosen, a Select Box Enhancer for jQuery and Prototype
Version 2.2.1
Full source at https://github.com/jjj/chosen
Copyright (c) 2011-2021 JJJ
Copyright (c) 2011-2022 JJJ
MIT License, https://github.com/jjj/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
*/
Expand Down Expand Up @@ -1281,7 +1281,6 @@ This file is generated by `grunt build`, do not edit it by hand.
}
this.active_field = true;
this.search_field.value = this.get_search_field_value();
this.search_field.writeAttribute("aria-expanded", "true");
this.search_results.writeAttribute("aria-busy", "false");
return this.search_field.focus();
}
Expand Down Expand Up @@ -1356,6 +1355,7 @@ This file is generated by `grunt build`, do not edit it by hand.
}
this.container.addClassName("chosen-with-drop");
this.results_showing = true;
this.search_field.writeAttribute("aria-expanded", "true");
this.search_field.focus();
this.search_field.value = this.get_search_field_value();
this.winnow_results();
Expand Down Expand Up @@ -1384,6 +1384,7 @@ This file is generated by `grunt build`, do not edit it by hand.
chosen: this
});
}
this.search_field.writeAttribute("aria-expanded", "false");
return this.results_showing = false;
}

Expand Down
4 changes: 2 additions & 2 deletions docs/chosen.proto.min.js

Large diffs are not rendered by default.

0 comments on commit 4afd715

Please sign in to comment.