Skip to content

ui5-list: tagName TypeError when a ui5-li-custom item isn't rendered yet during list render #14008

Description

@Lukas742

Bug Description

Since 2.26.0, a ui5-list containing ui5-li-custom items can throw during render ending up without height.

You can see that here in our Storybook, the MessageView renders a list with custom list items: https://ui5.github.io/webcomponents-react/v2/iframe.html?id=user-feedback-messageview--default&viewMode=story

So without a patch, the MessageView component is not usable with v2.26.0 of ui5wc/r.

AI generated analysis:

While the list renders, ariaDescriptionText_hasInteractiveItems iterates the items and calls _hasFocusableElements() on each custom item → _getFocusableElements()getTabbableElements(this.getFocusDomRef()). If an item hasn't finished its first render, getFocusDomRef() returns undefined, and getTabbableElements dereferences it (el.tagName) with no null-check, throwing and aborting the list render.

Affected Component

ui5-list, ui5-li-custom

Expected Behaviour

The list should render without throwing when a custom item's DOM ref isn't ready yet — getTabbableElements(undefined) should return [] (or the callers should skip items without a focus DOM ref).

Isolated Example

https://stackblitz.com/edit/github-7gvnntpw?file=index.html,main.js

Steps to Reproduce

  1. Open the isolated example.
  2. On load, an Uncaught TypeError: Cannot read properties of undefined (reading 'tagName') is thrown (deterministic; getFocusDomRef() logs undefined).

In a real app / production build the same throw happens inside the list's own render, so the list (and components built on it) render blank.

Log Output, Stack Trace or Screenshots

TypeError: Cannot read properties of undefined (reading 'tagName')
    at getTabbableElements
    at ListItemCustom._getFocusableElements
    at ListItemCustom._hasFocusableElements
    at get _hasInteractiveItems   // Array.some over getItems()
    at get ariaDescriptionText
    at <list render>

Priority

High

UI5 Web Components Version

2.26.0

Browser

Chrome, Edge, Firefox, Safari

Operating System

No response

Additional Context

No response

Organization

UI5WCR

Declaration

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug in the code

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions