mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
UX: Make the .selected class follow focus
This commit is contained in:
parent
3212cdda78
commit
59b7760e2e
@ -89,6 +89,8 @@ export default {
|
||||
this._bindToClick(binding.click, key);
|
||||
}
|
||||
});
|
||||
|
||||
this._bindFocus();
|
||||
},
|
||||
|
||||
toggleBookmark() {
|
||||
@ -308,6 +310,19 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
_bindFocus() {
|
||||
const addSelected = function(e, addOrRemove) {
|
||||
const row = '.topic-post, .topic-list-item, .topic-list tbody tr';
|
||||
const $wrapper = $(e.target).closest(row);
|
||||
const $srcWrapper = $(e.relatedTarget).closest(row);
|
||||
if (!$wrapper.is($srcWrapper)) $wrapper.toggleClass('selected', addOrRemove);
|
||||
};
|
||||
|
||||
const $document = $(document);
|
||||
$document.on('focusin.topic-post', e => addSelected(e, true));
|
||||
$document.on('focusout.topic-post', e => addSelected(e, false));
|
||||
},
|
||||
|
||||
_moveSelection(direction) {
|
||||
const $articles = this._findArticles();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user