Skip to content

Navigating beyond the end of legend items with arrow keys throws an error. #19621

Description

@tsvdb

Expected behaviour

No error should be thrown.

Actual behaviour

The console in the DevTools shows this output:

Uncaught TypeError: Cannot read properties of undefined (reading 'legendItem')
    at ea.b [as highlightLegendItem] (accessibility.src.js:3846:65)
    at G.onKbdArrowKey (accessibility.src.js:3778:29)
    at u.keyCodeMap (accessibility.src.js:3741:40)
    at q.run (accessibility.src.js:1302:32)
    at a.onKeydown (accessibility.src.js:3217:38)
    at HTMLDivElement.<anonymous> (accessibility.src.js:3060:71)

Live demo with steps to reproduce

https://jsfiddle.net/v8fp7z34/
Navigate through the legend items using the arrow keys and press the right or downwards arrow key when focusing the last legend item or press the left or upwards arrow key when focusing the first legend item.

Product version

Highcharts 11.1.0

Affected browser(s)

Firefox, Chrome, Edge

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions