Merge pull request #3181 from oliverguenther/fix/search_form_browser_consistency

Fix unstable focusing of search form in Firefox
pull/3190/head
Jan Sandbrink 9 years ago
commit a79a30c45d
  1. 9
      frontend/app/ui_components/expandable-search.js

@ -45,8 +45,13 @@ module.exports = function(ENTER_KEY) {
btn.on('click mousedown focus keypress', function(evt) {
if (scope.collapsed === true) {
setCollapsed(false);
// Avoid access key focus
setTimeout(function() { input.focus(); });
// Force focus to the search input
// The somewhat arbitrary delay of 20ms is required
// since Firefox blocks focus changing events
// immdetiately after an element is focused.
// Smaller delays will cause Firefox to ignore that focus
// Relevant: http://stackoverflow.com/questions/7046798
setTimeout(function() { input.focus(); }, 20);
// Hide on lost focus
elem.on('focusout', function() {

Loading…
Cancel
Save