Permalink
Browse files

fix(river): opening comment form auto-focuses input

The button is also blurred when the form is hidden.

The river filter now uses event delegation.
  • Loading branch information...
mrclay committed Dec 6, 2015
1 parent 941b49a commit 5b68badcaae36724d3b00406711bef7b30744615
Showing with 14 additions and 1 deletion.
  1. +14 −1 js/lib/ui.river.js
View
@@ -1,14 +1,27 @@
elgg.provide('elgg.ui.river');
elgg.ui.river.init = function() {
$('#elgg-river-selector').change(function() {
$(document).on('change', '#elgg-river-selector', function() {
var url = window.location.href;
if (window.location.search.length) {
url = url.substring(0, url.indexOf('?'));
}
url += '?' + $(this).val();
elgg.forward(url);
});
$(document).on('elgg_ui_toggle', function (e, data) {
var $toggle = $(e.target);
var $elements = data.$toggled_elements;
if ($elements.is('.elgg-river-responses > .elgg-form-comment-save')) {
if ($toggle.hasClass('elgg-state-active')) {
$elements.find('.elgg-input-text').focus();
} else {
$toggle.blur();
}
}
});
};
elgg.register_hook_handler('init', 'system', elgg.ui.river.init);

0 comments on commit 5b68bad

Please sign in to comment.