Skip to content

Click on legend item throws with Uncaught TypeError: Cannot read properties of undefined (reading 'background') #2814

@walterra

Description

@walterra

Describe the issue

When using Elastic Charts with vite bundler, clicking chart legend items throws with Uncaught TypeError: Cannot read properties of undefined (reading 'background').

Example package.json:

{
  "name": "charts-issue",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc -b && vite build",
    "lint": "eslint charts-issue",
    "preview": "vite preview"
  },
  "dependencies": {
    "@elastic/charts": "^74.0.0",
    "moment": "^2.30.1",
    "react": "^18.3.1",
    "react-dom": "^18.3.1"
  },
  "devDependencies": {
    "@eslint/js": "^9.39.4",
    "@types/node": "^24.12.0",
    "@types/react": "^19.2.14",
    "@types/react-dom": "^19.2.3",
    "@vitejs/plugin-react": "^6.0.1",
    "eslint": "^9.39.4",
    "eslint-plugin-react-hooks": "^7.0.1",
    "eslint-plugin-react-refresh": "^0.5.2",
    "globals": "^17.4.0",
    "typescript": "~5.9.3",
    "typescript-eslint": "^8.57.0",
    "vite": "^8.0.1"
  }
}

Screenshots

Image

Version (please complete the following information):

  • Bundler: vite
  • Elastic Charts: 74.0.0

Metadata

Metadata

Assignees

Labels

:interactionsInteractions related issuebugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions