Embedded image styling

Hello

I am try to make an Image undraggable or unselectable. Below is the code for creating a embedded object:

Embedded embeddedRsc = new Embedded(“”, new ThemeResource(“img/picture1.png”));
addComponent(embeddedRsc);
embeddedRsc .addStyleName(“disableDrag”);

And the CSS is as follows:
CSS:

​.v-embedded-disableDrag img {
draggable:false;
}

But the image remains draggable and the firebug does not include the above tag set by the CSS however the style name does come up. Is there anything wrong with the above CSS?

Hi,

this is because draggable is not a CSS rule, it should be set as a property on the img element itself. Like this:

<img draggable="false" ... />

The problem is that there’s really no way to set such properties with Vaadin. If you’re on Vaadin 7, you could just write a simple Extension that would just add the property to the image element on the client side.