Confusion about 'immediate' in Upload Component

I have spend a few hours puzzling over the whereabout of the Upload ‘browse’ button. I found that if you set Upload setImmediate(true), the button is not shown, otherwise it shows. This is different from the meaning of ‘immediate’ as I understand it: One would use setImmediate(true) to trigger an event immediately when the user selects or changes a previous selection.

What we have here is the use of Immediate to show/hide a button. This functionality gives ‘immediate’ a different meaning and confuses analogy.

Uploading a file is a two step tasks: (1) Browse and then (2) upload. The two tasks can be merged into one, but for completion and to avoid confusion, the “Browse” button could still be shown albeit disabled. The Immediate setting should have nothing to do with the ‘Browse’ button even if the user wanted an “immediate” upload of a file. It should only act when the ‘upload’ button is clicked.

Thanks.

Hi,

You’re right: when you set the Upload component to immediate, it changes how the component is displayed on client side. The file input element is still there, but it’s opacity is set to 0 – that is, it’s invisible, but still able to receive clicks (you can see in some browsers how the mouse pointer changes to a caret at the left edge of the Vaadin button because it’s actually hovering over the file input element’s text field). A Vaadin button is displayed at the same position as a target for the user to click on.

But “immediate” in this case is not just about displaying or not displaying certain parts of the UI. It’s also about when the file upload starts. In this case, it starts immediately after the user has selected a file from the browser’s file upload dialog. At least to me this is in line with the definition of immediate.