Skip to content

Commit

Permalink
fixed #143 by trying to give focus to first enabled input field for m…
Browse files Browse the repository at this point in the history
…odal dialogs when they are opened
  • Loading branch information
neocotic committed Apr 22, 2013
1 parent 26162f9 commit 1b7a4b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions chrome/bin/lib/options.js
Expand Up @@ -1762,6 +1762,9 @@
return analytics.track('Footer', 'Clicked', 'Donate');
});
load();
$('.modal').on('shown', function() {
return $(this).find(':input:enabled:first').focus();
});
$('#template_shortcut_modifier').html(ext.isThisPlatform('mac') ? ext.SHORTCUT_MAC_MODIFIERS : ext.SHORTCUT_MODIFIERS);
$('[popover]').each(function() {
var $this, placement, trigger;
Expand Down
4 changes: 4 additions & 0 deletions chrome/src/lib/options.coffee
Expand Up @@ -1435,6 +1435,10 @@ options = window.options = new class Options extends utils.Class
$('#donation').submit -> analytics.track 'Footer', 'Clicked', 'Donate'
# Load the current option values.
load()
# Ensure first enabled input field in modals get focus when opened.
$('.modal').on 'shown', ->
$(this).find(':input:enabled:first').focus()
# Apply OS-specific keyboard shortcut modifiers.
$('#template_shortcut_modifier').html if ext.isThisPlatform 'mac'
ext.SHORTCUT_MAC_MODIFIERS
else
Expand Down

0 comments on commit 1b7a4b1

Please sign in to comment.