Hardcoded attribute title="file input" (should be removed) #1526

Closed
alphestdev opened this Issue Feb 6, 2016 · 17 comments

Projects

None yet

3 participants

@alphestdev

FineUploader 5.5.0
fine-uploader.js
Line 1240

input.setAttribute("title", "file input");

All text should come from the template. Hardcoded text is not suitable, especially for multi-language environments.

@rnicholus
Member

Perhaps a title on a containing element that exists in the template will be sufficient. If not, that attribute can be transferred programmatically to the file input.

@rnicholus rnicholus added this to the 6.1.0 milestone Feb 6, 2016
@rnicholus rnicholus modified the milestone: 5.6.0, 6.1.0 Mar 20, 2016
@rnicholus
Member

Moving this to 5.6.0, and I'll start work on this at once.

@rnicholus
Member

In order to properly address this, I'll need to add a new text option, such as text.fileInputTitle. Here, you will be able to optionally specify a title attribute to be used when Fine Uploader created the <input type="file">.

You can't specify this yourself on the file input (easily) since it is removed and re-created whenever files are submitted to the uploader. This is the only way to "reset" the file input element. Another option would be to leave the title off of the file input and specify one on the parent element instead (such as the one in the template), but this will not work cross-browser. For example, Firefox defaults to the native hover tooltip when the file input title attribute is omitted. As a result, the text.fileInputTitle option appears to be the best solution.

@deviprsd21

That is the best way so far, of course, I found it really odd in my design to have the popup with a message not desired. It was irritating. So, I had a quick workaround

$("#fine-uploader").fineUploader({
    uploaderType: 'basic',
    // other options
}).on('complete', function(e, id, name, response){
    $(e.currentTarget).find('input[name="qqfile"]').attr('title', '');
}).find('input[name="qqfile"]').attr('title', '');

Like you said each time it was created and removed, so after each request completion I had to reset it again. And right after it returns the $("#fine-uploader") jQuery object after initialization.

@alphestdev

@deviprsd21 I did the same thing using onStatusChange to remove attribute as early as possible but still appeared for a short time and could be visible when hovered. I ended up removing the line from the fine-uploader source as I don't use tooltip text on a button that already has text.

@deviprsd21

Yup, anyway it has been added to the milestone for 5.6.0, all we have to do is wait.

@rnicholus
Member

I'm starting work on this feature this week, and once it is completed and verified by someone in this thread, I'll release 5.6.0.

@deviprsd21

Oh well, great 👍

@rnicholus rnicholus added a commit that referenced this issue Mar 22, 2016
@rnicholus rnicholus docs(options): typos
[skip ci]
#1526
6b6456a
@rnicholus
Member

This has been completed and is part of build 2 of 5.6.0. Please verify that this solves your issue. If it does, I'll formally release this as part of 5.6.0 next. You can download this pre-release build at http://releases.fineuploader.com/develop/5.6.0-2/fine-uploader-5.6.0-2.zip.

@rnicholus
Member

Note that I added a text.fileInputTitle option, and the extraButtons option also accepts a fileInputTitle.

@alphestdev

Tested 5.6.0-2. It works when explicitly defined as empty string. If the option is not set, it still appears as "file input".

@rnicholus
Member

Yes, this is the expected behavior. I kept the default value as I try to avoid any unnecessary changes in default behavior outside of a major version release.

@deviprsd21

@alphestdev that should be the normal behavior. You can set it as nothing and it won't appear I guess. Will try now. Have you updated the jQuery version also?

@rnicholus
Member

There is no jquery version. Fine Uploader offers an optional thin jquery wrapper around the library, but the wrapper provides no real value (#1310).

@rnicholus
Member

@deviprsd21 Look good on your end? If so, I'll release 5.6.0 today.

@deviprsd21

Works like charm 😍

@rnicholus rnicholus added a commit that closed this issue Mar 24, 2016
@rnicholus rnicholus feat(button.js): Allow <input type="file"> title attr to be specified
This also account for extraButtons.
closes #1526
1f53e80
@rnicholus rnicholus closed this in 1f53e80 Mar 24, 2016
@rnicholus
Member

This has been released as part of 5.6.0.

@qzminski qzminski referenced this issue in terminal42/contao-fineuploader Jul 19, 2016
Closed

Invalid title on upload button #42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment