Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add keyboard support with file button #183

Merged
merged 1 commit into from
Mar 14, 2017
Merged

Add keyboard support with file button #183

merged 1 commit into from
Mar 14, 2017

Conversation

phy25
Copy link
Contributor

@phy25 phy25 commented Jan 11, 2017

Test case: Use Tab to focus on select file button, and hit Enter.

This should be handled.

@LPology LPology merged commit 0c68f86 into LPology:master Mar 14, 2017
@LPology
Copy link
Owner

LPology commented Mar 14, 2017

Merging. Thanks for your contribution.

@LPology
Copy link
Owner

LPology commented Mar 14, 2017

I'm about to push a new release. I made a couple of small changes to your code, just fyi.

  1. Added precaution check for e.preventDefault (line 1062, approx):
if ( e && e.preventDefault ) {
    e.preventDefault();
}
  1. Added check for Internet Explorer (IE7-9 does not allow elem.click() on invisible file elements):

Line 49 (approx):

    isIE7to9 = ( navigator.userAgent.indexOf('MSIE') !== -1 &&
                 navigator.userAgent.indexOf('MSIE 1') === -1 ),

Line 1076 (approx):

if ( !isIE7to9 ) {
    self._input.click();
}

This allows the previous behavior to continue in IE7-9, otherwise an error will occur and uploads will not work until the page is reloaded.

@phy25
Copy link
Contributor Author

phy25 commented Mar 14, 2017

Fine. I didn't consider IE issue yet, so that's good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants