@@ -28,6 +28,8 @@ import 'highcharts/es-modules/masters/modules/xrange.src.js';
2828import 'highcharts/es-modules/masters/modules/bullet.src.js' ;
2929import 'highcharts/es-modules/masters/modules/gantt.src.js' ;
3030import 'highcharts/es-modules/masters/modules/draggable-points.src.js' ;
31+ import KeyboardNavigation from 'highcharts/es-modules/Accessibility/KeyboardNavigation.js' ;
32+ import HTMLUtilities from 'highcharts/es-modules/Accessibility/Utils/HTMLUtilities.js' ;
3133import Pointer from 'highcharts/es-modules/Core/Pointer.js' ;
3234import Highcharts from 'highcharts/es-modules/masters/highstock.src.js' ;
3335import { get } from '@vaadin/component-base/src/path-utils.js' ;
@@ -68,6 +70,35 @@ Pointer.prototype.onDocumentMouseMove = function (e) {
6870 }
6971} ;
7072
73+ // As the `mouseup` event is attached to the document element, the target will reference
74+ // the instance of the `vaadin-chart` element instead of the element the event originated from.
75+ // That causes some mishbehaviors, e.g. in a drilldown series, clicking in the point does not
76+ // drills down the series in some cases.
77+ // Change to check for the first element in the composed path as the target of the event.
78+ // Workaround for https://github.com/highcharts/highcharts/issues/23490
79+ //
80+ // TODO: Remove this monkeypatch once the referenced issue is fixed
81+ const { simulatedEventTarget } = HTMLUtilities ;
82+ KeyboardNavigation . prototype . onMouseUp = function ( e ) {
83+ delete this . isClickingChart ;
84+ if ( ! this . keyboardReset && e . relatedTarget !== simulatedEventTarget ) {
85+ const chart = this . chart ;
86+ const target = e . composedPath ( ) [ 0 ] ;
87+ if ( ! target || ! chart . container . contains ( target ) ) {
88+ const curMod = this . modules && this . modules [ this . currentModuleIx || 0 ] ;
89+ if ( curMod && curMod . terminate ) {
90+ curMod . terminate ( ) ;
91+ }
92+ this . currentModuleIx = 0 ;
93+ }
94+ if ( chart . focusElement ) {
95+ chart . focusElement . removeFocusBorder ( ) ;
96+ delete chart . focusElement ;
97+ }
98+ this . keyboardReset = true ;
99+ }
100+ } ;
101+
71102// Init Highcharts global language defaults
72103// No data message should be empty by default
73104Highcharts . setOptions ( { lang : { noData : '' } } ) ;
0 commit comments