Skip to content

Commit b6bb273

Browse files
committed
Merge branch 'gh-pages' of github.com:LeaVerou/awesomplete into gh-pages
2 parents 27e33c3 + f8bee8d commit b6bb273

6 files changed

Lines changed: 38 additions & 18 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Code Climate](https://img.shields.io/codeclimate/github/LeaVerou/awesomplete.svg)](https://codeclimate.com/github/LeaVerou/awesomplete)
55
[![Test Coverage](https://img.shields.io/codeclimate/coverage/github/LeaVerou/awesomplete.svg)](https://codeclimate.com/github/LeaVerou/awesomplete/coverage)
66

7-
http://leaverou.github.io/awesomplete/
7+
https://leaverou.github.io/awesomplete/
88

99
Awesomplete is an ultra lightweight, customizable, simple autocomplete widget with zero dependencies, built with modern standards for modern browsers.
1010

@@ -88,10 +88,10 @@ details.
8888

8989
## Links
9090

91-
The official site for the library is at <http://leaverou.github.io/awesomplete/>.
91+
The official site for the library is at <https://leaverou.github.io/awesomplete/>.
9292

9393
Documentation for the API and other topics is at
94-
<http://leaverou.github.io/awesomplete/#api>.
94+
<https://leaverou.github.io/awesomplete/#api>.
9595

9696
Created by Lea Verou and other fantastic contributors.
9797

awesomplete.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var _ = function (input, o) {
2020

2121
this.input = $(input);
2222
this.input.setAttribute("autocomplete", "off");
23+
this.input.setAttribute("aria-expanded", "false");
2324
this.input.setAttribute("aria-owns", "awesomplete_list_" + this.count);
2425
this.input.setAttribute("role", "combobox");
2526

@@ -76,10 +77,10 @@ var _ = function (input, o) {
7677
if(me.opened) {
7778
if (c === 13 && me.selected) { // Enter
7879
evt.preventDefault();
79-
me.select();
80+
me.select(undefined, undefined, evt);
8081
}
8182
else if (c === 9 && me.selected && me.tabSelect) {
82-
me.select();
83+
me.select(undefined, undefined, evt);
8384
}
8485
else if (c === 27) { // Esc
8586
me.close({ reason: "esc" });
@@ -113,7 +114,7 @@ var _ = function (input, o) {
113114

114115
if (li && evt.button === 0) { // Only select on left click
115116
evt.preventDefault();
116-
me.select(li, evt.target);
117+
me.select(li, evt.target, evt);
117118
}
118119
}
119120
}
@@ -180,6 +181,7 @@ _.prototype = {
180181
return;
181182
}
182183

184+
this.input.setAttribute("aria-expanded", "false");
183185
this.ul.setAttribute("hidden", "");
184186
this.isOpened = false;
185187
this.index = -1;
@@ -190,6 +192,7 @@ _.prototype = {
190192
},
191193

192194
open: function () {
195+
this.input.setAttribute("aria-expanded", "true");
193196
this.ul.removeAttribute("hidden");
194197
this.isOpened = true;
195198

@@ -266,7 +269,7 @@ _.prototype = {
266269
}
267270
},
268271

269-
select: function (selected, origin) {
272+
select: function (selected, origin, originalEvent) {
270273
if (selected) {
271274
this.index = $.siblingIndex(selected);
272275
} else {
@@ -278,14 +281,16 @@ _.prototype = {
278281

279282
var allowed = $.fire(this.input, "awesomplete-select", {
280283
text: suggestion,
281-
origin: origin || selected
284+
origin: origin || selected,
285+
originalEvent: originalEvent
282286
});
283287

284288
if (allowed) {
285289
this.replace(suggestion);
286290
this.close({ reason: "select" });
287291
$.fire(this.input, "awesomplete-selectcomplete", {
288-
text: suggestion
292+
text: suggestion,
293+
originalEvent: originalEvent
289294
});
290295
}
291296
}
@@ -369,8 +374,9 @@ _.ITEM = function (text, input, item_id) {
369374
var html = input.trim() === "" ? text : text.replace(RegExp($.regExpEscape(input.trim()), "gi"), "<mark>$&</mark>");
370375
return $.create("li", {
371376
innerHTML: html,
377+
"role": "option",
372378
"aria-selected": "false",
373-
"id": "awesomplete_list_" + this.count + "_item_" + item_id
379+
"id": "awesomplete_list_" + this.count + "_item_" + item_id
374380
});
375381
};
376382

awesomplete.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

awesomplete.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)