Skip to content

[Carousel]: Cannot set properties of null (setting 'innerText') #12282

@ZhekaVasil

Description

@ZhekaVasil

Description

What did you expect to happen?
When rendering a Carbon Carousel where all items fit within the visible area (i.e., no navigation controls are needed), the component should render cleanly without JavaScript errors.

What happened instead?
A runtime error is thrown in the console:
Uncaught TypeError: Cannot set properties of null (setting 'innerText')

Component(s) impacted

Carbon for IBM.com Carousel component
https://www.ibm.com/standards/carbon/web-components/react/?path=/story/components-carousel--default

Browser

Chrome

Carbon for IBM.com version

v2.17.1

Severity

Severity 3 = The problem is visible or noticeable to users but does not impede the usability or functionality. Affects minor functionality, has a workaround.

Application/website

Package

@carbon/ibmdotcom-web-components

CodeSandbox example

https://www.ibm.com/standards/carbon/web-components/react/?path=/story/components-carousel--default

Steps to reproduce the issue (if applicable)

The issue can be reproduced using Carbon for IBM.com Web Components with React v2.17.1 on the following Storybook page:
https://www.ibm.com/standards/carbon/web-components/react/?path=/story/components-carousel--default

To reproduce the error:

Open the page above.

In DevTools, set the CSS variable --c4d--carousel--page-size to 6 (to display all 6 carousel cards on a single page, removing the need for navigation).

Re-render the carousel by navigating to the "Docs" tab and then back to "Canvas".

Open the browser console — you'll see the following error:

Uncaught TypeError: Cannot set properties of null (setting 'innerText')

Image

This occurs because the carousel attempts to update an aria-live announcement element that is not present in the DOM when navigation is not rendered.

Release date (if applicable)

No response

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdevNeeds some dev work

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions