Selecting text in a disabled text component not possible in Firefox


Firefox has a bug
whereby it is not possible to select text in a textarea or input element that has the disabled attribute. In both Chrome and IE this is possible.

Vaadin adds this attribute when setEnabled(false) is called on a TextArea or TextField, regardless of browser.

What can I do to achieve the same behavior in Firefox that I have in Chrome and IE?


(One recommendation for Firefox is to use the readonly HTML attribute instead of disabled. However, I don’t see a way to do that with Vaadin.)

In Vaadin you can use TextField.setReadOnly(true); to disable modifying the Value (Warning: Also disables modification through code).
Then you can use css to change the look of the TextField/TextArea.

Thanks Marius. Unfortunately, I do need to be able to assign new data to the fields programatically. Only the user should be unable to make any changes.

You can still use setReadOnly(true) you just have to do this when assigning a value: textfield.setReadOnly(false); textfield.setValue("SomeValue"); textfield.setReadOnly(true);