Share highlighting behavior of userlist between mouse hover and keyboard selection

This effectively reproduces the behavior of the autocomplete menu.
This commit is contained in:
Jérémie Astori 2017-12-16 14:26:09 -05:00
parent 649d60c119
commit bfc8959bb9
No known key found for this signature in database
GPG key ID: B9A4F245CD67BDE8
2 changed files with 14 additions and 1 deletions

View file

@ -1204,7 +1204,7 @@ kbd {
color: #50a656;
}
#chat .user:hover {
.chat .user:hover {
opacity: 0.6;
}

View file

@ -39,6 +39,19 @@ chat.on("input", ".users .search", function() {
container.html(templates.user_filtered({matches: result})).show();
});
chat.on("mouseenter", ".users .user", function() {
// Reset any potential selection, this is required in cas there is already a
// nick previously selected by keyboard
$(".users .user").removeClass("active");
$(this).addClass("active");
});
chat.on("mouseleave", ".users .user", function() {
// Reset any potential selection
$(".users .user").removeClass("active");
});
exports.handleKeybinds = function(input) {
Mousetrap(input.get(0)).bind(["up", "down"], (_e, key) => {
const userlists = input.closest(".users");