diff options
| author | marktaiwan <mark.taiwan@gmail.com> | 2015-03-20 08:53:57 +0800 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2015-03-31 05:57:45 +0200 |
| commit | 6e84a25f9a882bc4c2cbd1e376416ac34ca9943b (patch) | |
| tree | dea05e389dbea2b43833a834600ecb689e0cad68 /js/file-selector.js | |
| parent | 4da073b6e85aae15b8eed227b3b3b16798d2a99e (diff) | |
Adds keyboard focus to file selector
Diffstat (limited to 'js/file-selector.js')
| -rw-r--r-- | js/file-selector.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/js/file-selector.js b/js/file-selector.js index e5451f1a..dbe8ea82 100644 --- a/js/file-selector.js +++ b/js/file-selector.js @@ -135,13 +135,21 @@ var dropHandlers = { $(document).on(dropHandlers, '.dropzone'); $(document).on('click', '.dropzone .remove-btn', function (e) { + e.stopPropagation(); + var file = $(e.target).parent().data('file-ref'); getThumbElement(file).remove(); removeFile(file); }); -$(document).on('click', '.dropzone .file-hint', function (e) { +$(document).on('keypress click', '.dropzone, .dropzone .file-hint', function (e) { + e.stopPropagation(); + + // accept mosue click or Enter + if (e.which != 1 || e.which != 13) + return; + var $fileSelector = $('<input type="file" multiple>'); $fileSelector.on('change', function (e) { |
