Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit 894e440

Browse files
author
Niall Kennedy
committed
consistent styling between keyboard and mouse item focus. do not display FBID value when moving between items via keyboard
1 parent 6220c02 commit 894e440

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

static/js/fb-demo-share.js

+20
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ FB_DEMO.share = {
112112
appendTo: "#composer-place-group",
113113
autoFocus: true,
114114
minLength: 3,
115+
focus: function( event, ui ) {
116+
// add consistency between mouse and keyboard events
117+
if ( event.keyCode !== undefined ) {
118+
var menu = $(this).data("ui-autocomplete").menu.element, focused = menu.find("li:has(a.ui-state-focus)");
119+
menu.find(".ui-state-focus").removeClass("ui-state-focus");
120+
focused.addClass("ui-state-focus");
121+
menu=focused=null;
122+
}
123+
return false;
124+
},
115125
select: function( event, ui ) {
116126
FB_DEMO.share.place.tagged = {id:ui.item.value, name:ui.item.label, link:ui.item.link};
117127
FB_DEMO.share.build_with_at_text();
@@ -228,6 +238,16 @@ FB_DEMO.share = {
228238
appendTo: "#composer-friends-group",
229239
autoFocus: true,
230240
minLength: 2,
241+
focus: function( event, ui ) {
242+
// add consistency between mouse and keyboard events
243+
if ( event.keyCode !== undefined ) {
244+
var menu = $(this).data("ui-autocomplete").menu.element, focused = menu.find("li:has(a.ui-state-focus)");
245+
menu.find(".ui-state-focus").removeClass("ui-state-focus");
246+
focused.addClass("ui-state-focus");
247+
menu=focused=null;
248+
}
249+
return false;
250+
},
231251
select: function( event, ui ) {
232252
FB_DEMO.share.friends.tagged[ui.item.value] = {name:ui.item.label, link:ui.item.link};
233253
FB_DEMO.share.build_with_at_text();

0 commit comments

Comments
 (0)