SAP / ui5-webcomponents

UI5 Web Components - the enterprise-flavored sugar on top of native APIs! Build SAP Fiori user interfaces with the technology of your choice.
https://sap.github.io/ui5-webcomponents/
Apache License 2.0
1.56k stars 267 forks source link

[SF] [List]: onItemClick event returns wrong selected status #5213

Closed GongRichard closed 2 years ago

GongRichard commented 2 years ago

Describe the bug This is an SAP SuccessFactors product issue. For a MultiSelect mode list, when you click the item, the onItemClick event will return the wrong selected status. But if click the checkbox of the list item, the onItemClick event will return the correct selected status.

Isolated Example https://codesandbox.io/s/customlistitem-selectedissue-omxprm

To Reproduce Steps to reproduce the behavior:

  1. Go to 'https://codesandbox.io/s/customlistitem-selectedissue-omxprm'
  2. Click on custom list item and check the console log, you will see the wrong selected status returned.
  3. Click on the checkbox of custom list item and check the console log, you will see the correct selected status returned.

Expected behavior Click on custom list item and Click on the checkbox of custom list item should return the same selected status.

Screenshots N/A

UI5 Web Components for React Information @ui5/webcomponents version: 1.3.1 @ui5/webcomponents-react version: 0.23.1 Operating System: Browser:

Additional context Please put this issue as high priority.

Lukas742 commented 2 years ago

Hi @GongRichard

Thanks for reporting! I'll forward this issue to our UI5 Web Components Colleagues as the affected component is developed in their repository.

Hi colleagues, this issue is reproducible with plain ui5 web components. --> codeSandbox

LidiyaGeorgieva commented 2 years ago

Hello @SAP/ui5-webcomponents-topic-p please have a look at this issue

nnaydenow commented 2 years ago

Hi @GongRichard,

Item click and selection change are two different things. item-click event is fired when the user clicks over the list item, then we internally make selection request and when the request is completed ( default behaviour of item-click could be prevented ) then selection-changed event is fired. To observe the correct information about selected items we suggest to use selection-change event.

Regards, Nayden

GongRichard commented 2 years ago

Hi @nnaydenow,

From consuming side, no matter click the item or click the checkbox, it all means item click, so I think you need return same selected status.

Thanks, Richard