🌐 AI搜索 & 代理 主页
Skip to content

Commit cb97e58

Browse files
committed
apply accessibility attributes to suggestion template
1 parent 7c8aa88 commit cb97e58

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/typeahead/dataset.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,14 @@ var Dataset = (function() {
319319
pending: templates.pending && _.templatify(templates.pending),
320320
header: templates.header && _.templatify(templates.header),
321321
footer: templates.footer && _.templatify(templates.footer),
322-
suggestion: templates.suggestion || suggestionTemplate
322+
suggestion: templates.suggestion ? userSuggestionTemplate : suggestionTemplate
323323
};
324324

325+
function userSuggestionTemplate(context) {
326+
var template = templates.suggestion;
327+
return $(template(context)).attr("id", _.guid());
328+
}
329+
325330
function suggestionTemplate(context) {
326331
return $('<div role="option">').attr('id', _.guid()).text(displayFn(context));
327332
}

0 commit comments

Comments
 (0)