openui5 icon indicating copy to clipboard operation
openui5 copied to clipboard

sap.m.FeedListItem: `icon` related settings not updatable after initial rendering

Open boghyon opened this issue 5 years ago • 3 comments

OpenUI5 version:

Since https://github.com/SAP/openui5/commit/454a41c8b7034c673a9c34b92921ced54b7bdce5#diff-8b72ed9ca72d9bf06081308bacffad14f5719bade70ed486635cd5ec2bfabdfa

Steps to reproduce the problem

  1. Open https://jsbin.com/megaguq/edit?html,js,output
  2. Using the Control Tree diagnostic tool, play around with icon related settings such as setting icon to sap-icon://sap-ui5.

We can see that those changes are not applied even though the FeedListItem itself does get invalidated and rerenders. Because of this issue, also activeIcon fails to work since 1.88.

The main issue is at _getAvatar: https://github.com/SAP/openui5/blob/98bb2bda851303610df5809ae251adb7712049cc/src/sap.m/src/sap/m/FeedListItem.js#L441-L456

Unlike FeedInput, subsequent changes on Avatar are never applied.

A quick fix could look something like this:

FeedListItem.prototype._getAvatar = function() {
	var sIcon = this.getIcon();
	var sIconSrc = sIcon ? sIcon : "..."; // another issue: https://github.com/SAP/openui5/issues/3258
	var sId = this.getId() + "-icon";

	this.oAvatar = this.oAvatar || new Avatar(sId);
	this.oAvatar.applySettings({
		src: sIconSrc,
		displayShape: this.getIconDisplayShape(),
		initials: this.getIconInitials(),
		displaySize: this.getIconSize(),
		ariaLabelledBy: this.getSender()
	});
	// ...

But while we're at it: Avatar is currently defined with var Avatar = library.Avatar. Wouldn't it be better to properly require it in the dependency list early and then using "sap.m.Avatar" as the type of a hidden aggregation? Similar to _avatar in ListContentItem or _placeholder in ObjectPageHeaderContent. FeedListItems as well as FeedInputs are typically used with profile pictures as shown in the design guideline. Or what are the reasons for declaring the dependency like this var Avatar = library.Avatar?

boghyon avatar May 19 '21 13:05 boghyon

Hello @boghyon , Thank you for sharing this finding. I've created an internal incident 2180176686. The status of the issue will be updated here in GitHub. Regards, Tsanislav

tsanislavgatev avatar May 25 '21 13:05 tsanislavgatev

Changes is done for this issue with 8aba9a495979a9a97ba2ae68273939b7488d1082.

Madhu552 avatar Jun 08 '21 06:06 Madhu552

Hello,

As the issue seem to be fixed, I am closing the issue.

Best regards, Tereza

terezamch avatar Jan 05 '22 11:01 terezamch