Skip to content

[List]: Cannot read properties of null (reading 'item') in List.onItemToggle #13576

@KayKadner

Description

@KayKadner

Bug Description

We see via sentry that the error Cannot read properties of null (reading 'item') happens in line

    onItemToggle(e) {
        this.fireEvent("item-toggle", { item: e.detail.item });
    }

of @ui5/webcomponents/dist/List.js?:587:56

as in the onItemClose function above

	onItemClose(e: CustomEvent<ListItemCloseEventDetail>) {
		const target = e.target as UI5Element | null;
		const shouldFireItemClose = target?.hasAttribute("ui5-li-notification") || target?.hasAttribute("ui5-li-notification-group");

		if (shouldFireItemClose) {
			this.fireDecoratorEvent("item-close", { item: e.detail?.item });
		}
	}

also contains a optional chaining in this case, I'm wondering if this might just be forgotten in onItemToggle

This was observed in 1.24.24, but it's also there in the latest version:

this.fireDecoratorEvent("item-toggle", { item: e.detail.item });

Affected Component

List

Expected Behaviour

no exception.

Isolated Example

No response

Steps to Reproduce

sorry, this is only an observation of what happens on customer side.

Log Output, Stack Trace or Screenshots

Image

Priority

None

UI5 Web Components Version

1.24.24

Browser

Chrome

Operating System

No response

Additional Context

No response

Organization

No response

Declaration

  • I’m not disclosing any internal or sensitive information.

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

Status
In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions