Automatically apply selected style to component?
In AEM 6.0 SP2, when using the touch UI on a component that uses the "Component Styles" functionality, the component does not apply the new class to the component until after a page refresh. To reproduce this issue:
- Go to the "Discover Geometrixx" sample page (http://localhost:4502/editor.html/content/geometrixx/en/company/discover_geometrixx.html)
- Select the Text/Image component that says "Geometrixx was founded in 545..."
- Click the dialog "wrench" icon
- In the Component Styles tab, change the image alignment from "Left" to "Right"
- Close the dialog with the "check mark" icon
- Observe that the image alignment did not change
- NOTE: You can see in a network trace that the component is refreshed from the server as an ajax call (GET textimage_0.html...), and the class "image_right" is added to the parbase div in the response HTML. However, if you then inspect the DOM, you'll see that for some reason the "image_right" class is no longer applied to the parbase div after it is updated in the DOM. This happens in latest Chrome and in IE 11.
- Refresh the page
- Observe that the image alignment now shows correctly
This is happening in our new site as well with our own custom components that use the Component Styles dialog functionality and it is very annoying for authors. The only work-around we've found is to add a cq:listeners to refresh the page automatically, but this is a very poor work-around since unless the component is at the top of the page, the author has to scroll back to where they were editing. Is there a work-around or a patch to fix this issue so in-place update of the component style works without full page refresh?