Merge pull request #2815 from cpradio/tab-to-first-link-on-post-when-using-keyboard

FIX: j/k place tab focus accordingly so tab will go to the first linked ...
This commit is contained in:
Sam 2014-09-23 07:38:49 +10:00
commit e8bbc147ad

View File

@ -233,6 +233,15 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
if ($article.size() > 0) {
$articles.removeClass('selected');
$article.addClass('selected');
if ($article.is('.topic-post')) {
var tabLoc = $article.find('a.tabLoc');
if (tabLoc.length === 0) {
tabLoc = $('<a href="#" class="tabLoc"></a>');
$article.prepend(tabLoc);
}
tabLoc.focus();
}
var rgx = new RegExp("post-cloak-(\\d+)").exec($article.parent()[0].id);
if (rgx === null || typeof rgx[1] === 'undefined') {