vaadin / collaboration-engine

The simplest way to build real-time collaboration into web apps
https://vaadin.com/collaboration
Other
3 stars 1 forks source link

[AvatarGroup] Avatar group should not have an auto width of 100% #62

Closed stefanuebe closed 2 years ago

stefanuebe commented 2 years ago

Describe the bug Currently the avatar group has a width of 100 % set to it. This makes it necessary to add an extra step, when this sample here shall be reproduced with a horizontal layout and positioning the elements at the right side (e.g. as it is known from google docs).

To fix this, the dev has to manually override the width to something like

group.setWidth("auto");

Default: image

Expected: image

Sample code (in a vertical layout)

UserInfo userInfo = getUserInfo();

CollaborationAvatarGroup group = new CollaborationAvatarGroup(userInfo, getTopicId());
// Exclude own avatar from the group:
group.setOwnAvatarVisible(false);

Avatar ownAvatar = new Avatar();
ownAvatar.setName(userInfo.getName());
ownAvatar.setImage(userInfo.getImage());

HorizontalLayout avatars = new HorizontalLayout(group, ownAvatar);
avatars.setJustifyContentMode(JustifyContentMode.END);
add(avatars);

setHorizontalComponentAlignment(Alignment.END, group);

// this does not work
group.setSizeUndefined();

// this does work
group.setWidth("auto");
web-padawan commented 2 years ago

Issue moved to vaadin/web-components #3554 via ZenHub