highcharts 9.3.0 → 9.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bower.json +1 -1
- package/es-modules/Accessibility/Accessibility.js +5 -1
- package/es-modules/Accessibility/Components/InfoRegionsComponent.js +130 -84
- package/es-modules/Accessibility/Components/MenuComponent.js +195 -120
- package/es-modules/Accessibility/Components/RangeSelectorComponent.js +166 -81
- package/es-modules/Accessibility/KeyboardNavigation.js +2 -1
- package/es-modules/Core/Axis/OrdinalAxis.js +0 -4
- package/es-modules/Core/Globals.js +1 -1
- package/es-modules/Core/Renderer/SVG/SVGRenderer.js +1 -1
- package/es-modules/Extensions/Annotations/NavigationBindings.js +23 -10
- package/es-modules/Extensions/Annotations/Popup.js +1 -1
- package/es-modules/Extensions/Boost/BoostOptions.js +2 -2
- package/es-modules/Extensions/Exporting/Exporting.js +2 -2
- package/es-modules/Extensions/OfflineExporting/OfflineExportingDefaults.js +1 -1
- package/es-modules/Extensions/Oldie/Oldie.js +1 -1
- package/es-modules/Extensions/Polar.js +1 -1
- package/es-modules/Maps/MapView.js +5 -5
- package/es-modules/Maps/MapViewOptionsDefault.js +4 -2
- package/es-modules/Maps/Projection.js +3 -0
- package/es-modules/Maps/Projections/EqualEarth.js +7 -7
- package/es-modules/Maps/Projections/LambertConformalConic.js +52 -0
- package/es-modules/Maps/Projections/Miller.js +5 -6
- package/es-modules/Maps/Projections/Orthographic.js +4 -4
- package/es-modules/Maps/Projections/ProjectionRegistry.js +2 -0
- package/es-modules/Maps/Projections/WebMercator.js +2 -3
- package/es-modules/Series/Map/MapSeries.js +3 -0
- package/es-modules/Series/MapLine/MapLineSeries.js +2 -0
- package/es-modules/Series/MapPoint/MapPointSeries.js +13 -11
- package/es-modules/Stock/Indicators/SMA/SMAIndicator.js +23 -17
- package/es-modules/Stock/Indicators/VBP/VBPIndicator.js +3 -4
- package/es-modules/Stock/StockToolsGui.js +5 -5
- package/es-modules/masters/highcharts-3d.src.js +1 -1
- package/es-modules/masters/highcharts-gantt.src.js +1 -1
- package/es-modules/masters/highcharts-more.src.js +1 -1
- package/es-modules/masters/highcharts.src.js +1 -1
- package/es-modules/masters/highmaps.src.js +1 -1
- package/es-modules/masters/highstock.src.js +1 -1
- package/es-modules/masters/indicators/acceleration-bands.src.js +1 -1
- package/es-modules/masters/indicators/accumulation-distribution.src.js +1 -1
- package/es-modules/masters/indicators/ao.src.js +1 -1
- package/es-modules/masters/indicators/apo.src.js +1 -1
- package/es-modules/masters/indicators/aroon-oscillator.src.js +1 -1
- package/es-modules/masters/indicators/aroon.src.js +1 -1
- package/es-modules/masters/indicators/atr.src.js +1 -1
- package/es-modules/masters/indicators/bollinger-bands.src.js +1 -1
- package/es-modules/masters/indicators/cci.src.js +1 -1
- package/es-modules/masters/indicators/chaikin.src.js +1 -1
- package/es-modules/masters/indicators/cmf.src.js +1 -1
- package/es-modules/masters/indicators/cmo.src.js +1 -1
- package/es-modules/masters/indicators/dema.src.js +1 -1
- package/es-modules/masters/indicators/disparity-index.src.js +1 -1
- package/es-modules/masters/indicators/dmi.src.js +1 -1
- package/es-modules/masters/indicators/dpo.src.js +1 -1
- package/es-modules/masters/indicators/ichimoku-kinko-hyo.src.js +1 -1
- package/es-modules/masters/indicators/indicators-all.src.js +1 -1
- package/es-modules/masters/indicators/indicators.src.js +1 -1
- package/es-modules/masters/indicators/keltner-channels.src.js +1 -1
- package/es-modules/masters/indicators/klinger.src.js +1 -1
- package/es-modules/masters/indicators/macd.src.js +1 -1
- package/es-modules/masters/indicators/mfi.src.js +1 -1
- package/es-modules/masters/indicators/momentum.src.js +1 -1
- package/es-modules/masters/indicators/natr.src.js +1 -1
- package/es-modules/masters/indicators/obv.src.js +1 -1
- package/es-modules/masters/indicators/pivot-points.src.js +1 -1
- package/es-modules/masters/indicators/ppo.src.js +1 -1
- package/es-modules/masters/indicators/price-channel.src.js +1 -1
- package/es-modules/masters/indicators/price-envelopes.src.js +1 -1
- package/es-modules/masters/indicators/psar.src.js +1 -1
- package/es-modules/masters/indicators/regressions.src.js +1 -1
- package/es-modules/masters/indicators/roc.src.js +1 -1
- package/es-modules/masters/indicators/rsi.src.js +1 -1
- package/es-modules/masters/indicators/slow-stochastic.src.js +1 -1
- package/es-modules/masters/indicators/stochastic.src.js +1 -1
- package/es-modules/masters/indicators/supertrend.src.js +1 -1
- package/es-modules/masters/indicators/tema.src.js +1 -1
- package/es-modules/masters/indicators/trendline.src.js +1 -1
- package/es-modules/masters/indicators/trix.src.js +1 -1
- package/es-modules/masters/indicators/volume-by-price.src.js +1 -1
- package/es-modules/masters/indicators/vwap.src.js +1 -1
- package/es-modules/masters/indicators/williams-r.src.js +1 -1
- package/es-modules/masters/indicators/wma.src.js +1 -1
- package/es-modules/masters/indicators/zigzag.src.js +1 -1
- package/es-modules/masters/modules/accessibility.src.js +2 -2
- package/es-modules/masters/modules/annotations-advanced.src.js +1 -1
- package/es-modules/masters/modules/annotations.src.js +1 -1
- package/es-modules/masters/modules/arrow-symbols.src.js +1 -1
- package/es-modules/masters/modules/boost-canvas.src.js +1 -1
- package/es-modules/masters/modules/boost.src.js +1 -1
- package/es-modules/masters/modules/broken-axis.src.js +1 -1
- package/es-modules/masters/modules/bullet.src.js +1 -1
- package/es-modules/masters/modules/coloraxis.src.js +1 -1
- package/es-modules/masters/modules/current-date-indicator.src.js +1 -1
- package/es-modules/masters/modules/cylinder.src.js +1 -1
- package/es-modules/masters/modules/data.src.js +1 -1
- package/es-modules/masters/modules/datagrouping.src.js +1 -1
- package/es-modules/masters/modules/debugger.src.js +1 -1
- package/es-modules/masters/modules/dependency-wheel.src.js +1 -1
- package/es-modules/masters/modules/dotplot.src.js +1 -1
- package/es-modules/masters/modules/drag-panes.src.js +1 -1
- package/es-modules/masters/modules/draggable-points.src.js +1 -1
- package/es-modules/masters/modules/drilldown.src.js +1 -1
- package/es-modules/masters/modules/dumbbell.src.js +1 -1
- package/es-modules/masters/modules/export-data.src.js +1 -1
- package/es-modules/masters/modules/exporting.src.js +1 -1
- package/es-modules/masters/modules/full-screen.src.js +1 -1
- package/es-modules/masters/modules/funnel.src.js +1 -1
- package/es-modules/masters/modules/funnel3d.src.js +1 -1
- package/es-modules/masters/modules/gantt.src.js +1 -1
- package/es-modules/masters/modules/grid-axis.src.js +1 -1
- package/es-modules/masters/modules/heatmap.src.js +1 -1
- package/es-modules/masters/modules/heikinashi.src.js +1 -1
- package/es-modules/masters/modules/histogram-bellcurve.src.js +1 -1
- package/es-modules/masters/modules/hollowcandlestick.src.js +1 -1
- package/es-modules/masters/modules/item-series.src.js +1 -1
- package/es-modules/masters/modules/lollipop.src.js +1 -1
- package/es-modules/masters/modules/map.src.js +1 -1
- package/es-modules/masters/modules/marker-clusters.src.js +1 -1
- package/es-modules/masters/modules/networkgraph.src.js +1 -1
- package/es-modules/masters/modules/no-data-to-display.src.js +1 -1
- package/es-modules/masters/modules/offline-exporting.src.js +1 -1
- package/es-modules/masters/modules/oldie-polyfills.src.js +1 -1
- package/es-modules/masters/modules/oldie.src.js +1 -1
- package/es-modules/masters/modules/organization.src.js +1 -1
- package/es-modules/masters/modules/overlapping-datalabels.src.js +1 -1
- package/es-modules/masters/modules/parallel-coordinates.src.js +1 -1
- package/es-modules/masters/modules/pareto.src.js +1 -1
- package/es-modules/masters/modules/pathfinder.src.js +1 -1
- package/es-modules/masters/modules/pattern-fill.src.js +1 -1
- package/es-modules/masters/modules/price-indicator.src.js +1 -1
- package/es-modules/masters/modules/pyramid3d.src.js +1 -1
- package/es-modules/masters/modules/sankey.src.js +1 -1
- package/es-modules/masters/modules/series-label.src.js +1 -1
- package/es-modules/masters/modules/solid-gauge.src.js +1 -1
- package/es-modules/masters/modules/sonification.src.js +1 -1
- package/es-modules/masters/modules/static-scale.src.js +1 -1
- package/es-modules/masters/modules/stock-tools.src.js +1 -1
- package/es-modules/masters/modules/stock.src.js +1 -1
- package/es-modules/masters/modules/streamgraph.src.js +1 -1
- package/es-modules/masters/modules/sunburst.src.js +1 -1
- package/es-modules/masters/modules/tilemap.src.js +1 -1
- package/es-modules/masters/modules/timeline.src.js +1 -1
- package/es-modules/masters/modules/treegrid.src.js +1 -1
- package/es-modules/masters/modules/treemap.src.js +1 -1
- package/es-modules/masters/modules/variable-pie.src.js +1 -1
- package/es-modules/masters/modules/variwide.src.js +1 -1
- package/es-modules/masters/modules/vector.src.js +1 -1
- package/es-modules/masters/modules/venn.src.js +1 -1
- package/es-modules/masters/modules/windbarb.src.js +1 -1
- package/es-modules/masters/modules/wordcloud.src.js +1 -1
- package/es-modules/masters/modules/xrange.src.js +1 -1
- package/es-modules/masters/themes/avocado.src.js +1 -1
- package/es-modules/masters/themes/dark-blue.src.js +1 -1
- package/es-modules/masters/themes/dark-green.src.js +1 -1
- package/es-modules/masters/themes/dark-unica.src.js +1 -1
- package/es-modules/masters/themes/gray.src.js +1 -1
- package/es-modules/masters/themes/grid-light.src.js +1 -1
- package/es-modules/masters/themes/grid.src.js +1 -1
- package/es-modules/masters/themes/high-contrast-dark.src.js +1 -1
- package/es-modules/masters/themes/high-contrast-light.src.js +1 -1
- package/es-modules/masters/themes/sand-signika.src.js +1 -1
- package/es-modules/masters/themes/skies.src.js +1 -1
- package/es-modules/masters/themes/sunset.src.js +1 -1
- package/highcharts-3d.js +1 -1
- package/highcharts-3d.src.js +1 -1
- package/highcharts-gantt.js +3 -3
- package/highcharts-gantt.src.js +3 -3
- package/highcharts-more.js +2 -2
- package/highcharts-more.js.map +1 -1
- package/highcharts-more.src.js +2 -2
- package/highcharts.d.ts +126 -9
- package/highcharts.js +3 -3
- package/highcharts.src.d.ts +126 -9
- package/highcharts.src.js +3 -3
- package/highmaps.js +655 -653
- package/highmaps.js.map +1 -1
- package/highmaps.src.js +131 -43
- package/highstock.js +61 -61
- package/highstock.js.map +1 -1
- package/highstock.src.js +3 -7
- package/indicators/acceleration-bands.js +1 -1
- package/indicators/acceleration-bands.src.js +1 -1
- package/indicators/accumulation-distribution.js +1 -1
- package/indicators/accumulation-distribution.src.js +1 -1
- package/indicators/ao.js +1 -1
- package/indicators/ao.src.js +1 -1
- package/indicators/apo.js +1 -1
- package/indicators/apo.src.js +1 -1
- package/indicators/aroon-oscillator.js +1 -1
- package/indicators/aroon-oscillator.src.js +1 -1
- package/indicators/aroon.js +1 -1
- package/indicators/aroon.src.js +1 -1
- package/indicators/atr.js +1 -1
- package/indicators/atr.src.js +1 -1
- package/indicators/bollinger-bands.js +1 -1
- package/indicators/bollinger-bands.src.js +1 -1
- package/indicators/cci.js +1 -1
- package/indicators/cci.src.js +1 -1
- package/indicators/chaikin.js +1 -1
- package/indicators/chaikin.src.js +1 -1
- package/indicators/cmf.js +1 -1
- package/indicators/cmf.src.js +1 -1
- package/indicators/cmo.js +1 -1
- package/indicators/cmo.src.js +1 -1
- package/indicators/dema.js +1 -1
- package/indicators/dema.src.js +1 -1
- package/indicators/disparity-index.js +1 -1
- package/indicators/disparity-index.src.js +1 -1
- package/indicators/dmi.js +1 -1
- package/indicators/dmi.src.js +1 -1
- package/indicators/dpo.js +1 -1
- package/indicators/dpo.src.js +1 -1
- package/indicators/ichimoku-kinko-hyo.js +1 -1
- package/indicators/ichimoku-kinko-hyo.src.js +1 -1
- package/indicators/indicators-all.js +72 -72
- package/indicators/indicators-all.js.map +1 -1
- package/indicators/indicators-all.src.js +29 -24
- package/indicators/indicators.js +10 -10
- package/indicators/indicators.js.map +1 -1
- package/indicators/indicators.src.js +26 -20
- package/indicators/keltner-channels.js +1 -1
- package/indicators/keltner-channels.src.js +1 -1
- package/indicators/klinger.js +1 -1
- package/indicators/klinger.src.js +1 -1
- package/indicators/macd.js +1 -1
- package/indicators/macd.src.js +1 -1
- package/indicators/mfi.js +1 -1
- package/indicators/mfi.src.js +1 -1
- package/indicators/momentum.js +1 -1
- package/indicators/momentum.src.js +1 -1
- package/indicators/natr.js +1 -1
- package/indicators/natr.src.js +1 -1
- package/indicators/obv.js +1 -1
- package/indicators/obv.src.js +1 -1
- package/indicators/pivot-points.js +1 -1
- package/indicators/pivot-points.src.js +1 -1
- package/indicators/ppo.js +1 -1
- package/indicators/ppo.src.js +1 -1
- package/indicators/price-channel.js +1 -1
- package/indicators/price-channel.src.js +1 -1
- package/indicators/price-envelopes.js +1 -1
- package/indicators/price-envelopes.src.js +1 -1
- package/indicators/psar.js +1 -1
- package/indicators/psar.src.js +1 -1
- package/indicators/regressions.js +1 -1
- package/indicators/regressions.src.js +1 -1
- package/indicators/roc.js +1 -1
- package/indicators/roc.src.js +1 -1
- package/indicators/rsi.js +1 -1
- package/indicators/rsi.src.js +1 -1
- package/indicators/slow-stochastic.js +1 -1
- package/indicators/slow-stochastic.src.js +1 -1
- package/indicators/stochastic.js +1 -1
- package/indicators/stochastic.src.js +1 -1
- package/indicators/supertrend.js +1 -1
- package/indicators/supertrend.src.js +1 -1
- package/indicators/tema.js +1 -1
- package/indicators/tema.src.js +1 -1
- package/indicators/trendline.js +1 -1
- package/indicators/trendline.src.js +1 -1
- package/indicators/trix.js +1 -1
- package/indicators/trix.src.js +1 -1
- package/indicators/volume-by-price.js +2 -2
- package/indicators/volume-by-price.js.map +1 -1
- package/indicators/volume-by-price.src.js +4 -5
- package/indicators/vwap.js +1 -1
- package/indicators/vwap.src.js +1 -1
- package/indicators/williams-r.js +1 -1
- package/indicators/williams-r.src.js +1 -1
- package/indicators/wma.js +1 -1
- package/indicators/wma.src.js +1 -1
- package/indicators/zigzag.js +1 -1
- package/indicators/zigzag.src.js +1 -1
- package/modules/accessibility.js +225 -222
- package/modules/accessibility.js.map +1 -1
- package/modules/accessibility.src.js +1306 -1085
- package/modules/annotations-advanced.js +153 -152
- package/modules/annotations-advanced.js.map +1 -1
- package/modules/annotations-advanced.src.js +26 -12
- package/modules/annotations.js +81 -80
- package/modules/annotations.js.map +1 -1
- package/modules/annotations.src.js +26 -12
- package/modules/arrow-symbols.js +1 -1
- package/modules/arrow-symbols.src.js +1 -1
- package/modules/boost-canvas.js +1 -1
- package/modules/boost-canvas.src.js +1 -1
- package/modules/boost.js +1 -1
- package/modules/boost.src.js +1 -1
- package/modules/broken-axis.js +1 -1
- package/modules/broken-axis.src.js +1 -1
- package/modules/bullet.js +1 -1
- package/modules/bullet.src.js +1 -1
- package/modules/coloraxis.js +1 -1
- package/modules/coloraxis.src.js +1 -1
- package/modules/current-date-indicator.js +1 -1
- package/modules/current-date-indicator.src.js +1 -1
- package/modules/cylinder.js +1 -1
- package/modules/cylinder.src.js +1 -1
- package/modules/data.js +1 -1
- package/modules/data.src.js +1 -1
- package/modules/datagrouping.js +1 -1
- package/modules/datagrouping.src.js +1 -1
- package/modules/debugger.js +1 -1
- package/modules/debugger.src.js +1 -1
- package/modules/dependency-wheel.js +1 -1
- package/modules/dependency-wheel.src.js +1 -1
- package/modules/dotplot.js +1 -1
- package/modules/dotplot.src.js +1 -1
- package/modules/drag-panes.js +1 -1
- package/modules/drag-panes.src.js +1 -1
- package/modules/draggable-points.js +1 -1
- package/modules/draggable-points.src.js +1 -1
- package/modules/drilldown.js +1 -1
- package/modules/drilldown.src.js +1 -1
- package/modules/dumbbell.js +1 -1
- package/modules/dumbbell.src.js +1 -1
- package/modules/export-data.js +1 -1
- package/modules/export-data.src.js +1 -1
- package/modules/exporting.js +35 -35
- package/modules/exporting.js.map +1 -1
- package/modules/exporting.src.js +3 -3
- package/modules/full-screen.js +1 -1
- package/modules/full-screen.src.js +1 -1
- package/modules/funnel.js +1 -1
- package/modules/funnel.src.js +1 -1
- package/modules/funnel3d.js +1 -1
- package/modules/funnel3d.src.js +1 -1
- package/modules/gantt.js +1 -1
- package/modules/gantt.src.js +1 -1
- package/modules/grid-axis.js +1 -1
- package/modules/grid-axis.src.js +1 -1
- package/modules/heatmap.js +1 -1
- package/modules/heatmap.src.js +1 -1
- package/modules/heikinashi.js +1 -1
- package/modules/heikinashi.src.js +1 -1
- package/modules/histogram-bellcurve.js +1 -1
- package/modules/histogram-bellcurve.src.js +1 -1
- package/modules/hollowcandlestick.js +1 -1
- package/modules/hollowcandlestick.src.js +1 -1
- package/modules/item-series.js +1 -1
- package/modules/item-series.src.js +1 -1
- package/modules/lollipop.js +1 -1
- package/modules/lollipop.src.js +1 -1
- package/modules/map.d.ts +2 -2
- package/modules/map.js +143 -141
- package/modules/map.js.map +1 -1
- package/modules/map.src.d.ts +2 -2
- package/modules/map.src.js +129 -41
- package/modules/marker-clusters.js +1 -1
- package/modules/marker-clusters.src.js +1 -1
- package/modules/networkgraph.js +1 -1
- package/modules/networkgraph.src.js +1 -1
- package/modules/no-data-to-display.js +1 -1
- package/modules/no-data-to-display.src.js +1 -1
- package/modules/offline-exporting.js +2 -2
- package/modules/offline-exporting.src.js +2 -2
- package/modules/oldie-polyfills.js +1 -1
- package/modules/oldie-polyfills.src.js +1 -1
- package/modules/oldie.js +2 -2
- package/modules/oldie.src.js +2 -2
- package/modules/organization.js +1 -1
- package/modules/organization.src.js +1 -1
- package/modules/overlapping-datalabels.js +1 -1
- package/modules/overlapping-datalabels.src.js +1 -1
- package/modules/parallel-coordinates.js +1 -1
- package/modules/parallel-coordinates.src.js +1 -1
- package/modules/pareto.js +1 -1
- package/modules/pareto.src.js +1 -1
- package/modules/pathfinder.js +1 -1
- package/modules/pathfinder.src.js +1 -1
- package/modules/pattern-fill.js +1 -1
- package/modules/pattern-fill.src.js +1 -1
- package/modules/price-indicator.js +1 -1
- package/modules/price-indicator.src.js +1 -1
- package/modules/pyramid3d.js +1 -1
- package/modules/pyramid3d.src.js +1 -1
- package/modules/sankey.js +1 -1
- package/modules/sankey.src.js +1 -1
- package/modules/series-label.js +1 -1
- package/modules/series-label.src.js +1 -1
- package/modules/solid-gauge.js +1 -1
- package/modules/solid-gauge.src.js +1 -1
- package/modules/sonification.js +1 -1
- package/modules/sonification.src.js +1 -1
- package/modules/static-scale.js +1 -1
- package/modules/static-scale.src.js +1 -1
- package/modules/stock-tools.js +86 -84
- package/modules/stock-tools.js.map +1 -1
- package/modules/stock-tools.src.js +30 -16
- package/modules/stock.js +90 -90
- package/modules/stock.js.map +1 -1
- package/modules/stock.src.js +1 -5
- package/modules/streamgraph.js +1 -1
- package/modules/streamgraph.src.js +1 -1
- package/modules/sunburst.js +1 -1
- package/modules/sunburst.src.js +1 -1
- package/modules/tilemap.js +1 -1
- package/modules/tilemap.src.js +1 -1
- package/modules/timeline.js +1 -1
- package/modules/timeline.src.js +1 -1
- package/modules/treegrid.js +1 -1
- package/modules/treegrid.src.js +1 -1
- package/modules/treemap.js +1 -1
- package/modules/treemap.src.js +1 -1
- package/modules/variable-pie.js +1 -1
- package/modules/variable-pie.src.js +1 -1
- package/modules/variwide.js +1 -1
- package/modules/variwide.src.js +1 -1
- package/modules/vector.js +1 -1
- package/modules/vector.src.js +1 -1
- package/modules/venn.js +1 -1
- package/modules/venn.src.js +1 -1
- package/modules/windbarb.js +1 -1
- package/modules/windbarb.src.js +1 -1
- package/modules/wordcloud.js +1 -1
- package/modules/wordcloud.src.js +1 -1
- package/modules/xrange.js +1 -1
- package/modules/xrange.src.js +1 -1
- package/package.json +1 -1
- package/themes/avocado.js +1 -1
- package/themes/avocado.src.js +1 -1
- package/themes/dark-blue.js +1 -1
- package/themes/dark-blue.src.js +1 -1
- package/themes/dark-green.js +1 -1
- package/themes/dark-green.src.js +1 -1
- package/themes/dark-unica.js +1 -1
- package/themes/dark-unica.src.js +1 -1
- package/themes/gray.js +1 -1
- package/themes/gray.src.js +1 -1
- package/themes/grid-light.js +1 -1
- package/themes/grid-light.src.js +1 -1
- package/themes/grid.js +1 -1
- package/themes/grid.src.js +1 -1
- package/themes/high-contrast-dark.js +1 -1
- package/themes/high-contrast-dark.src.js +1 -1
- package/themes/high-contrast-light.js +1 -1
- package/themes/high-contrast-light.src.js +1 -1
- package/themes/sand-signika.js +1 -1
- package/themes/sand-signika.src.js +1 -1
- package/themes/skies.js +1 -1
- package/themes/skies.src.js +1 -1
- package/themes/sunset.js +1 -1
- package/themes/sunset.src.js +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Highcharts JS v9.3.
|
|
2
|
+
* @license Highcharts JS v9.3.1 (2021-11-05)
|
|
3
3
|
*
|
|
4
4
|
* Accessibility module
|
|
5
5
|
*
|
|
@@ -2112,7 +2112,7 @@
|
|
|
2112
2112
|
|
|
2113
2113
|
return AnnotationsA11y;
|
|
2114
2114
|
});
|
|
2115
|
-
_registerModule(_modules, 'Accessibility/Components/InfoRegionsComponent.js', [_modules['
|
|
2115
|
+
_registerModule(_modules, 'Accessibility/Components/InfoRegionsComponent.js', [_modules['Accessibility/A11yI18n.js'], _modules['Accessibility/AccessibilityComponent.js'], _modules['Accessibility/Utils/Announcer.js'], _modules['Accessibility/Components/AnnotationsA11y.js'], _modules['Core/Renderer/HTML/AST.js'], _modules['Accessibility/Utils/ChartUtilities.js'], _modules['Core/FormatUtilities.js'], _modules['Core/Globals.js'], _modules['Accessibility/Utils/HTMLUtilities.js'], _modules['Core/Utilities.js']], function (A11yI18n, AccessibilityComponent, Announcer, AnnotationsA11y, AST, CU, F, H, HU, U) {
|
|
2116
2116
|
/* *
|
|
2117
2117
|
*
|
|
2118
2118
|
* (c) 2009-2021 Øystein Moseng
|
|
@@ -2124,27 +2124,47 @@
|
|
|
2124
2124
|
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
2125
2125
|
*
|
|
2126
2126
|
* */
|
|
2127
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2128
|
+
var extendStatics = function (d,
|
|
2129
|
+
b) {
|
|
2130
|
+
extendStatics = Object.setPrototypeOf ||
|
|
2131
|
+
({ __proto__: [] } instanceof Array && function (d,
|
|
2132
|
+
b) { d.__proto__ = b; }) ||
|
|
2133
|
+
function (d,
|
|
2134
|
+
b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
2135
|
+
return extendStatics(d, b);
|
|
2136
|
+
};
|
|
2137
|
+
return function (d, b) {
|
|
2138
|
+
extendStatics(d, b);
|
|
2139
|
+
function __() { this.constructor = d; }
|
|
2140
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2141
|
+
};
|
|
2142
|
+
})();
|
|
2143
|
+
var getAnnotationsInfoHTML = AnnotationsA11y.getAnnotationsInfoHTML;
|
|
2144
|
+
var getAxisDescription = CU.getAxisDescription,
|
|
2145
|
+
getAxisRangeDescription = CU.getAxisRangeDescription,
|
|
2146
|
+
getChartTitle = CU.getChartTitle,
|
|
2147
|
+
unhideChartElementFromAT = CU.unhideChartElementFromAT;
|
|
2127
2148
|
var format = F.format;
|
|
2128
2149
|
var doc = H.doc;
|
|
2150
|
+
var addClass = HU.addClass,
|
|
2151
|
+
getElement = HU.getElement,
|
|
2152
|
+
getHeadingTagNameForElement = HU.getHeadingTagNameForElement,
|
|
2153
|
+
stripHTMLTagsFromString = HU.stripHTMLTagsFromString,
|
|
2154
|
+
visuallyHideElement = HU.visuallyHideElement;
|
|
2129
2155
|
var attr = U.attr,
|
|
2130
|
-
extend = U.extend,
|
|
2131
2156
|
pick = U.pick;
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
getElement = HTMLUtilities.getElement,
|
|
2139
|
-
getHeadingTagNameForElement = HTMLUtilities.getHeadingTagNameForElement,
|
|
2140
|
-
stripHTMLTagsFromString = HTMLUtilities.stripHTMLTagsFromString,
|
|
2141
|
-
visuallyHideElement = HTMLUtilities.visuallyHideElement;
|
|
2142
|
-
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
2157
|
+
/* *
|
|
2158
|
+
*
|
|
2159
|
+
* Functions
|
|
2160
|
+
*
|
|
2161
|
+
* */
|
|
2162
|
+
/* eslint-disable valid-jsdoc */
|
|
2143
2163
|
/**
|
|
2144
2164
|
* @private
|
|
2145
2165
|
*/
|
|
2146
|
-
function
|
|
2147
|
-
return
|
|
2166
|
+
function getTableSummary(chart) {
|
|
2167
|
+
return chart.langFormat('accessibility.table.tableSummary', { chart: chart });
|
|
2148
2168
|
}
|
|
2149
2169
|
/**
|
|
2150
2170
|
* @private
|
|
@@ -2175,40 +2195,46 @@
|
|
|
2175
2195
|
chart.langFormat('accessibility.chartTypes.default' + multi, context)) + (typeExplaination ? ' ' + typeExplaination : '');
|
|
2176
2196
|
}
|
|
2177
2197
|
/**
|
|
2178
|
-
*
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
return chart.langFormat('accessibility.table.tableSummary', { chart: chart });
|
|
2182
|
-
}
|
|
2183
|
-
/**
|
|
2184
|
-
* Return simplified explaination of chart type. Some types will not be familiar
|
|
2185
|
-
* to most users, but in those cases we try to add an explaination of the type.
|
|
2198
|
+
* Return simplified explaination of chart type. Some types will not be
|
|
2199
|
+
* familiar to most users, but in those cases we try to add an explaination
|
|
2200
|
+
* of the type.
|
|
2186
2201
|
*
|
|
2187
2202
|
* @private
|
|
2188
2203
|
* @function Highcharts.Chart#getTypeDescription
|
|
2189
2204
|
* @param {Array<string>} types The series types in this chart.
|
|
2190
2205
|
* @return {string} The text description of the chart type.
|
|
2191
2206
|
*/
|
|
2192
|
-
|
|
2207
|
+
function getTypeDescription(chart, types) {
|
|
2193
2208
|
var firstType = types[0],
|
|
2194
|
-
firstSeries =
|
|
2209
|
+
firstSeries = chart.series && chart.series[0] || {},
|
|
2195
2210
|
formatContext = {
|
|
2196
|
-
numSeries:
|
|
2211
|
+
numSeries: chart.series.length,
|
|
2197
2212
|
numPoints: firstSeries.points && firstSeries.points.length,
|
|
2198
|
-
chart:
|
|
2213
|
+
chart: chart,
|
|
2199
2214
|
mapTitle: firstSeries.mapTitle
|
|
2200
2215
|
};
|
|
2201
2216
|
if (!firstType) {
|
|
2202
|
-
return getTypeDescForEmptyChart(
|
|
2217
|
+
return getTypeDescForEmptyChart(chart, formatContext);
|
|
2203
2218
|
}
|
|
2204
2219
|
if (firstType === 'map') {
|
|
2205
|
-
return getTypeDescForMapChart(
|
|
2220
|
+
return getTypeDescForMapChart(chart, formatContext);
|
|
2206
2221
|
}
|
|
2207
|
-
if (
|
|
2208
|
-
return getTypeDescForCombinationChart(
|
|
2222
|
+
if (chart.types.length > 1) {
|
|
2223
|
+
return getTypeDescForCombinationChart(chart, formatContext);
|
|
2209
2224
|
}
|
|
2210
|
-
return buildTypeDescriptionFromSeries(
|
|
2211
|
-
}
|
|
2225
|
+
return buildTypeDescriptionFromSeries(chart, types, formatContext);
|
|
2226
|
+
}
|
|
2227
|
+
/**
|
|
2228
|
+
* @private
|
|
2229
|
+
*/
|
|
2230
|
+
function stripEmptyHTMLTags(str) {
|
|
2231
|
+
return str.replace(/<(\w+)[^>]*?>\s*<\/\1>/g, '');
|
|
2232
|
+
}
|
|
2233
|
+
/* *
|
|
2234
|
+
*
|
|
2235
|
+
* Class
|
|
2236
|
+
*
|
|
2237
|
+
* */
|
|
2212
2238
|
/**
|
|
2213
2239
|
* The InfoRegionsComponent class
|
|
2214
2240
|
*
|
|
@@ -2216,14 +2242,31 @@
|
|
|
2216
2242
|
* @class
|
|
2217
2243
|
* @name Highcharts.InfoRegionsComponent
|
|
2218
2244
|
*/
|
|
2219
|
-
var InfoRegionsComponent = function () {
|
|
2220
|
-
|
|
2221
|
-
|
|
2245
|
+
var InfoRegionsComponent = /** @class */ (function (_super) {
|
|
2246
|
+
__extends(InfoRegionsComponent, _super);
|
|
2247
|
+
function InfoRegionsComponent() {
|
|
2248
|
+
/* *
|
|
2249
|
+
*
|
|
2250
|
+
* Properties
|
|
2251
|
+
*
|
|
2252
|
+
* */
|
|
2253
|
+
var _this = _super !== null && _super.apply(this,
|
|
2254
|
+
arguments) || this;
|
|
2255
|
+
_this.announcer = void 0;
|
|
2256
|
+
_this.screenReaderSections = {};
|
|
2257
|
+
return _this;
|
|
2258
|
+
}
|
|
2259
|
+
/* *
|
|
2260
|
+
*
|
|
2261
|
+
* Functions
|
|
2262
|
+
*
|
|
2263
|
+
* */
|
|
2264
|
+
/* eslint-disable valid-jsdoc */
|
|
2222
2265
|
/**
|
|
2223
2266
|
* Init the component
|
|
2224
2267
|
* @private
|
|
2225
2268
|
*/
|
|
2226
|
-
init
|
|
2269
|
+
InfoRegionsComponent.prototype.init = function () {
|
|
2227
2270
|
var chart = this.chart;
|
|
2228
2271
|
var component = this;
|
|
2229
2272
|
this.initRegionsDefinitions();
|
|
@@ -2238,11 +2281,11 @@
|
|
|
2238
2281
|
}, 300);
|
|
2239
2282
|
});
|
|
2240
2283
|
this.announcer = new Announcer(chart, 'assertive');
|
|
2241
|
-
}
|
|
2284
|
+
};
|
|
2242
2285
|
/**
|
|
2243
2286
|
* @private
|
|
2244
2287
|
*/
|
|
2245
|
-
initRegionsDefinitions
|
|
2288
|
+
InfoRegionsComponent.prototype.initRegionsDefinitions = function () {
|
|
2246
2289
|
var component = this;
|
|
2247
2290
|
this.screenReaderSections = {
|
|
2248
2291
|
before: {
|
|
@@ -2284,23 +2327,23 @@
|
|
|
2284
2327
|
}
|
|
2285
2328
|
}
|
|
2286
2329
|
};
|
|
2287
|
-
}
|
|
2330
|
+
};
|
|
2288
2331
|
/**
|
|
2289
2332
|
* Called on chart render. Have to update the sections on render, in order
|
|
2290
2333
|
* to get a11y info from series.
|
|
2291
2334
|
*/
|
|
2292
|
-
onChartRender
|
|
2335
|
+
InfoRegionsComponent.prototype.onChartRender = function () {
|
|
2293
2336
|
var component = this;
|
|
2294
2337
|
this.linkedDescriptionElement = this.getLinkedDescriptionElement();
|
|
2295
2338
|
this.setLinkedDescriptionAttrs();
|
|
2296
2339
|
Object.keys(this.screenReaderSections).forEach(function (regionKey) {
|
|
2297
2340
|
component.updateScreenReaderSection(regionKey);
|
|
2298
2341
|
});
|
|
2299
|
-
}
|
|
2342
|
+
};
|
|
2300
2343
|
/**
|
|
2301
2344
|
* @private
|
|
2302
2345
|
*/
|
|
2303
|
-
getLinkedDescriptionElement
|
|
2346
|
+
InfoRegionsComponent.prototype.getLinkedDescriptionElement = function () {
|
|
2304
2347
|
var chartOptions = this.chart.options,
|
|
2305
2348
|
linkedDescOption = chartOptions.accessibility.linkedDescription;
|
|
2306
2349
|
if (!linkedDescOption) {
|
|
@@ -2315,22 +2358,23 @@
|
|
|
2315
2358
|
if (queryMatch.length === 1) {
|
|
2316
2359
|
return queryMatch[0];
|
|
2317
2360
|
}
|
|
2318
|
-
}
|
|
2361
|
+
};
|
|
2319
2362
|
/**
|
|
2320
2363
|
* @private
|
|
2321
2364
|
*/
|
|
2322
|
-
setLinkedDescriptionAttrs
|
|
2365
|
+
InfoRegionsComponent.prototype.setLinkedDescriptionAttrs = function () {
|
|
2323
2366
|
var el = this.linkedDescriptionElement;
|
|
2324
2367
|
if (el) {
|
|
2325
2368
|
el.setAttribute('aria-hidden', 'true');
|
|
2326
2369
|
addClass(el, 'highcharts-linked-description');
|
|
2327
2370
|
}
|
|
2328
|
-
}
|
|
2371
|
+
};
|
|
2329
2372
|
/**
|
|
2330
2373
|
* @private
|
|
2331
|
-
* @param {string} regionKey
|
|
2374
|
+
* @param {string} regionKey
|
|
2375
|
+
* The name/key of the region to update
|
|
2332
2376
|
*/
|
|
2333
|
-
updateScreenReaderSection
|
|
2377
|
+
InfoRegionsComponent.prototype.updateScreenReaderSection = function (regionKey) {
|
|
2334
2378
|
var chart = this.chart;
|
|
2335
2379
|
var region = this.screenReaderSections[regionKey];
|
|
2336
2380
|
var content = region.buildContent(chart);
|
|
@@ -2358,13 +2402,13 @@
|
|
|
2358
2402
|
}
|
|
2359
2403
|
delete region.element;
|
|
2360
2404
|
}
|
|
2361
|
-
}
|
|
2405
|
+
};
|
|
2362
2406
|
/**
|
|
2363
2407
|
* @private
|
|
2364
2408
|
* @param {Highcharts.HTMLDOMElement} sectionDiv The section element
|
|
2365
2409
|
* @param {string} regionKey Name/key of the region we are setting attrs for
|
|
2366
2410
|
*/
|
|
2367
|
-
setScreenReaderSectionAttribs
|
|
2411
|
+
InfoRegionsComponent.prototype.setScreenReaderSectionAttribs = function (sectionDiv, regionKey) {
|
|
2368
2412
|
var labelLangKey = ('accessibility.screenReaderSection.' + regionKey + 'RegionLabel'), chart = this.chart, labelText = chart.langFormat(labelLangKey, { chart: chart, chartTitle: getChartTitle(chart) }), sectionId = 'highcharts-screen-reader-region-' + regionKey + '-' +
|
|
2369
2413
|
chart.index;
|
|
2370
2414
|
attr(sectionDiv, {
|
|
@@ -2378,12 +2422,12 @@
|
|
|
2378
2422
|
labelText) {
|
|
2379
2423
|
sectionDiv.setAttribute('role', 'region');
|
|
2380
2424
|
}
|
|
2381
|
-
}
|
|
2425
|
+
};
|
|
2382
2426
|
/**
|
|
2383
2427
|
* @private
|
|
2384
2428
|
* @return {string}
|
|
2385
2429
|
*/
|
|
2386
|
-
defaultBeforeChartFormatter
|
|
2430
|
+
InfoRegionsComponent.prototype.defaultBeforeChartFormatter = function () {
|
|
2387
2431
|
var chart = this.chart;
|
|
2388
2432
|
var format = chart.options.accessibility.screenReaderSection.beforeChartFormat;
|
|
2389
2433
|
if (!format) {
|
|
@@ -2420,12 +2464,12 @@
|
|
|
2420
2464
|
this.dataTableButtonId = dataTableButtonId;
|
|
2421
2465
|
this.sonifyButtonId = sonifyButtonId;
|
|
2422
2466
|
return stripEmptyHTMLTags(formattedString);
|
|
2423
|
-
}
|
|
2467
|
+
};
|
|
2424
2468
|
/**
|
|
2425
2469
|
* @private
|
|
2426
2470
|
* @return {string}
|
|
2427
2471
|
*/
|
|
2428
|
-
defaultAfterChartFormatter
|
|
2472
|
+
InfoRegionsComponent.prototype.defaultAfterChartFormatter = function () {
|
|
2429
2473
|
var chart = this.chart;
|
|
2430
2474
|
var format = chart.options.accessibility.screenReaderSection.afterChartFormat;
|
|
2431
2475
|
if (!format) {
|
|
@@ -2436,21 +2480,21 @@
|
|
|
2436
2480
|
context,
|
|
2437
2481
|
chart);
|
|
2438
2482
|
return stripEmptyHTMLTags(formattedString);
|
|
2439
|
-
}
|
|
2483
|
+
};
|
|
2440
2484
|
/**
|
|
2441
2485
|
* @private
|
|
2442
2486
|
* @return {string}
|
|
2443
2487
|
*/
|
|
2444
|
-
getLinkedDescription
|
|
2488
|
+
InfoRegionsComponent.prototype.getLinkedDescription = function () {
|
|
2445
2489
|
var el = this.linkedDescriptionElement,
|
|
2446
2490
|
content = el && el.innerHTML || '';
|
|
2447
2491
|
return stripHTMLTagsFromString(content);
|
|
2448
|
-
}
|
|
2492
|
+
};
|
|
2449
2493
|
/**
|
|
2450
2494
|
* @private
|
|
2451
2495
|
* @return {string}
|
|
2452
2496
|
*/
|
|
2453
|
-
getLongdescText
|
|
2497
|
+
InfoRegionsComponent.prototype.getLongdescText = function () {
|
|
2454
2498
|
var chartOptions = this.chart.options,
|
|
2455
2499
|
captionOptions = chartOptions.caption,
|
|
2456
2500
|
captionText = captionOptions && captionOptions.text,
|
|
@@ -2459,34 +2503,34 @@
|
|
|
2459
2503
|
linkedDescription ||
|
|
2460
2504
|
captionText ||
|
|
2461
2505
|
'');
|
|
2462
|
-
}
|
|
2506
|
+
};
|
|
2463
2507
|
/**
|
|
2464
2508
|
* @private
|
|
2465
2509
|
* @return {string}
|
|
2466
2510
|
*/
|
|
2467
|
-
getTypeDescriptionText
|
|
2511
|
+
InfoRegionsComponent.prototype.getTypeDescriptionText = function () {
|
|
2468
2512
|
var chart = this.chart;
|
|
2469
2513
|
return chart.types ?
|
|
2470
2514
|
chart.options.accessibility.typeDescription ||
|
|
2471
|
-
|
|
2472
|
-
}
|
|
2515
|
+
getTypeDescription(chart, chart.types) : '';
|
|
2516
|
+
};
|
|
2473
2517
|
/**
|
|
2474
2518
|
* @private
|
|
2475
2519
|
* @param {string} buttonId
|
|
2476
2520
|
* @return {string}
|
|
2477
2521
|
*/
|
|
2478
|
-
getDataTableButtonText
|
|
2522
|
+
InfoRegionsComponent.prototype.getDataTableButtonText = function (buttonId) {
|
|
2479
2523
|
var chart = this.chart,
|
|
2480
2524
|
buttonText = chart.langFormat('accessibility.table.viewAsDataTableButtonText', { chart: chart,
|
|
2481
2525
|
chartTitle: getChartTitle(chart) });
|
|
2482
2526
|
return '<button id="' + buttonId + '">' + buttonText + '</button>';
|
|
2483
|
-
}
|
|
2527
|
+
};
|
|
2484
2528
|
/**
|
|
2485
2529
|
* @private
|
|
2486
2530
|
* @param {string} buttonId
|
|
2487
2531
|
* @return {string}
|
|
2488
2532
|
*/
|
|
2489
|
-
getSonifyButtonText
|
|
2533
|
+
InfoRegionsComponent.prototype.getSonifyButtonText = function (buttonId) {
|
|
2490
2534
|
var chart = this.chart;
|
|
2491
2535
|
if (chart.options.sonification &&
|
|
2492
2536
|
chart.options.sonification.enabled === false) {
|
|
@@ -2495,28 +2539,28 @@
|
|
|
2495
2539
|
var buttonText = chart.langFormat('accessibility.sonification.playAsSoundButtonText', { chart: chart,
|
|
2496
2540
|
chartTitle: getChartTitle(chart) });
|
|
2497
2541
|
return '<button id="' + buttonId + '">' + buttonText + '</button>';
|
|
2498
|
-
}
|
|
2542
|
+
};
|
|
2499
2543
|
/**
|
|
2500
2544
|
* @private
|
|
2501
2545
|
* @return {string}
|
|
2502
2546
|
*/
|
|
2503
|
-
getSubtitleText
|
|
2547
|
+
InfoRegionsComponent.prototype.getSubtitleText = function () {
|
|
2504
2548
|
var subtitle = (this.chart.options.subtitle);
|
|
2505
2549
|
return stripHTMLTagsFromString(subtitle && subtitle.text || '');
|
|
2506
|
-
}
|
|
2550
|
+
};
|
|
2507
2551
|
/**
|
|
2508
2552
|
* @private
|
|
2509
2553
|
* @return {string}
|
|
2510
2554
|
*/
|
|
2511
|
-
getEndOfChartMarkerText
|
|
2555
|
+
InfoRegionsComponent.prototype.getEndOfChartMarkerText = function () {
|
|
2512
2556
|
var chart = this.chart, markerText = chart.langFormat('accessibility.screenReaderSection.endOfChartMarker', { chart: chart }), id = 'highcharts-end-of-chart-marker-' + chart.index;
|
|
2513
2557
|
return '<div id="' + id + '">' + markerText + '</div>';
|
|
2514
|
-
}
|
|
2558
|
+
};
|
|
2515
2559
|
/**
|
|
2516
2560
|
* @private
|
|
2517
2561
|
* @param {Highcharts.Dictionary<string>} e
|
|
2518
2562
|
*/
|
|
2519
|
-
onDataTableCreated
|
|
2563
|
+
InfoRegionsComponent.prototype.onDataTableCreated = function (e) {
|
|
2520
2564
|
var chart = this.chart;
|
|
2521
2565
|
if (chart.options.accessibility.enabled) {
|
|
2522
2566
|
if (this.viewDataTableButton) {
|
|
@@ -2527,22 +2571,22 @@
|
|
|
2527
2571
|
attributes.summary = getTableSummary(chart);
|
|
2528
2572
|
e.tree.attributes = attributes;
|
|
2529
2573
|
}
|
|
2530
|
-
}
|
|
2574
|
+
};
|
|
2531
2575
|
/**
|
|
2532
2576
|
* @private
|
|
2533
2577
|
*/
|
|
2534
|
-
focusDataTable
|
|
2578
|
+
InfoRegionsComponent.prototype.focusDataTable = function () {
|
|
2535
2579
|
var tableDiv = this.dataTableDiv,
|
|
2536
2580
|
table = tableDiv && tableDiv.getElementsByTagName('table')[0];
|
|
2537
2581
|
if (table && table.focus) {
|
|
2538
2582
|
table.focus();
|
|
2539
2583
|
}
|
|
2540
|
-
}
|
|
2584
|
+
};
|
|
2541
2585
|
/**
|
|
2542
2586
|
* @private
|
|
2543
2587
|
* @param {string} sonifyButtonId
|
|
2544
2588
|
*/
|
|
2545
|
-
initSonifyButton
|
|
2589
|
+
InfoRegionsComponent.prototype.initSonifyButton = function (sonifyButtonId) {
|
|
2546
2590
|
var _this = this;
|
|
2547
2591
|
var el = this.sonifyButton = getElement(sonifyButtonId);
|
|
2548
2592
|
var chart = this.chart;
|
|
@@ -2573,13 +2617,13 @@
|
|
|
2573
2617
|
(onPlayAsSoundClick || defaultHandler).call(this, e, chart);
|
|
2574
2618
|
};
|
|
2575
2619
|
}
|
|
2576
|
-
}
|
|
2620
|
+
};
|
|
2577
2621
|
/**
|
|
2578
2622
|
* Set attribs and handlers for default viewAsDataTable button if exists.
|
|
2579
2623
|
* @private
|
|
2580
2624
|
* @param {string} tableButtonId
|
|
2581
2625
|
*/
|
|
2582
|
-
initDataTableButton
|
|
2626
|
+
InfoRegionsComponent.prototype.initDataTableButton = function (tableButtonId) {
|
|
2583
2627
|
var el = this.viewDataTableButton = getElement(tableButtonId), chart = this.chart, tableId = tableButtonId.replace('hc-linkto-', '');
|
|
2584
2628
|
if (el) {
|
|
2585
2629
|
attr(el, {
|
|
@@ -2592,13 +2636,13 @@
|
|
|
2592
2636
|
chart.viewData();
|
|
2593
2637
|
};
|
|
2594
2638
|
}
|
|
2595
|
-
}
|
|
2639
|
+
};
|
|
2596
2640
|
/**
|
|
2597
2641
|
* Return object with text description of each of the chart's axes.
|
|
2598
2642
|
* @private
|
|
2599
2643
|
* @return {Highcharts.Dictionary<string>}
|
|
2600
2644
|
*/
|
|
2601
|
-
getAxesDescription
|
|
2645
|
+
InfoRegionsComponent.prototype.getAxesDescription = function () {
|
|
2602
2646
|
var chart = this.chart,
|
|
2603
2647
|
shouldDescribeColl = function (collectionKey,
|
|
2604
2648
|
defaultCondition) {
|
|
@@ -2614,13 +2658,13 @@
|
|
|
2614
2658
|
desc.yAxis = this.getAxisDescriptionText('yAxis');
|
|
2615
2659
|
}
|
|
2616
2660
|
return desc;
|
|
2617
|
-
}
|
|
2661
|
+
};
|
|
2618
2662
|
/**
|
|
2619
2663
|
* @private
|
|
2620
2664
|
* @param {string} collectionKey
|
|
2621
2665
|
* @return {string}
|
|
2622
2666
|
*/
|
|
2623
|
-
getAxisDescriptionText
|
|
2667
|
+
InfoRegionsComponent.prototype.getAxisDescriptionText = function (collectionKey) {
|
|
2624
2668
|
var chart = this.chart;
|
|
2625
2669
|
var axes = chart[collectionKey];
|
|
2626
2670
|
return chart.langFormat('accessibility.axis.' + collectionKey + 'Description' + (axes.length > 1 ? 'Plural' : 'Singular'), {
|
|
@@ -2633,75 +2677,103 @@
|
|
|
2633
2677
|
}),
|
|
2634
2678
|
numAxes: axes.length
|
|
2635
2679
|
});
|
|
2636
|
-
}
|
|
2680
|
+
};
|
|
2637
2681
|
/**
|
|
2638
2682
|
* Remove component traces
|
|
2639
2683
|
*/
|
|
2640
|
-
destroy
|
|
2684
|
+
InfoRegionsComponent.prototype.destroy = function () {
|
|
2641
2685
|
if (this.announcer) {
|
|
2642
2686
|
this.announcer.destroy();
|
|
2643
2687
|
}
|
|
2644
|
-
}
|
|
2645
|
-
|
|
2688
|
+
};
|
|
2689
|
+
return InfoRegionsComponent;
|
|
2690
|
+
}(AccessibilityComponent));
|
|
2691
|
+
/* *
|
|
2692
|
+
*
|
|
2693
|
+
* Default Export
|
|
2694
|
+
*
|
|
2695
|
+
* */
|
|
2646
2696
|
|
|
2647
2697
|
return InfoRegionsComponent;
|
|
2648
2698
|
});
|
|
2649
|
-
_registerModule(_modules, 'Accessibility/
|
|
2699
|
+
_registerModule(_modules, 'Accessibility/Components/MenuComponent.js', [_modules['Core/Chart/Chart.js'], _modules['Core/Utilities.js'], _modules['Accessibility/AccessibilityComponent.js'], _modules['Accessibility/KeyboardNavigationHandler.js'], _modules['Accessibility/Utils/ChartUtilities.js'], _modules['Accessibility/Utils/HTMLUtilities.js']], function (Chart, U, AccessibilityComponent, KeyboardNavigationHandler, ChartUtilities, HTMLUtilities) {
|
|
2650
2700
|
/* *
|
|
2651
2701
|
*
|
|
2652
2702
|
* (c) 2009-2021 Øystein Moseng
|
|
2653
2703
|
*
|
|
2654
|
-
*
|
|
2704
|
+
* Accessibility component for exporting menu.
|
|
2655
2705
|
*
|
|
2656
2706
|
* License: www.highcharts.com/license
|
|
2657
2707
|
*
|
|
2658
2708
|
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
2659
2709
|
*
|
|
2660
2710
|
* */
|
|
2661
|
-
var
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2711
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2712
|
+
var extendStatics = function (d,
|
|
2713
|
+
b) {
|
|
2714
|
+
extendStatics = Object.setPrototypeOf ||
|
|
2715
|
+
({ __proto__: [] } instanceof Array && function (d,
|
|
2716
|
+
b) { d.__proto__ = b; }) ||
|
|
2717
|
+
function (d,
|
|
2718
|
+
b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
2719
|
+
return extendStatics(d, b);
|
|
2720
|
+
};
|
|
2721
|
+
return function (d, b) {
|
|
2722
|
+
extendStatics(d, b);
|
|
2723
|
+
function __() { this.constructor = d; }
|
|
2724
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2725
|
+
};
|
|
2726
|
+
})();
|
|
2727
|
+
var attr = U.attr;
|
|
2728
|
+
var getChartTitle = ChartUtilities.getChartTitle,
|
|
2729
|
+
unhideChartElementFromAT = ChartUtilities.unhideChartElementFromAT;
|
|
2730
|
+
var getFakeMouseEvent = HTMLUtilities.getFakeMouseEvent;
|
|
2666
2731
|
/* *
|
|
2667
2732
|
*
|
|
2668
|
-
*
|
|
2733
|
+
* Functions
|
|
2669
2734
|
*
|
|
2670
2735
|
* */
|
|
2736
|
+
/* eslint-disable valid-jsdoc */
|
|
2671
2737
|
/**
|
|
2672
|
-
*
|
|
2673
|
-
* logic for the chart.
|
|
2738
|
+
* Get the wrapped export button element of a chart.
|
|
2674
2739
|
*
|
|
2675
|
-
* @
|
|
2740
|
+
* @private
|
|
2741
|
+
* @param {Highcharts.Chart} chart
|
|
2742
|
+
* @returns {Highcharts.SVGElement}
|
|
2743
|
+
*/
|
|
2744
|
+
function getExportMenuButtonElement(chart) {
|
|
2745
|
+
return chart.exportSVGElements && chart.exportSVGElements[0];
|
|
2746
|
+
}
|
|
2747
|
+
/**
|
|
2748
|
+
* @private
|
|
2749
|
+
* @param {Highcharts.Chart} chart
|
|
2750
|
+
*/
|
|
2751
|
+
function exportingShouldHaveA11y(chart) {
|
|
2752
|
+
var exportingOpts = chart.options.exporting,
|
|
2753
|
+
exportButton = getExportMenuButtonElement(chart);
|
|
2754
|
+
return !!(exportingOpts &&
|
|
2755
|
+
exportingOpts.enabled !== false &&
|
|
2756
|
+
exportingOpts.accessibility &&
|
|
2757
|
+
exportingOpts.accessibility.enabled &&
|
|
2758
|
+
exportButton &&
|
|
2759
|
+
exportButton.element);
|
|
2760
|
+
}
|
|
2761
|
+
/* *
|
|
2762
|
+
*
|
|
2763
|
+
* Class
|
|
2764
|
+
*
|
|
2765
|
+
* */
|
|
2766
|
+
/**
|
|
2767
|
+
* The MenuComponent class
|
|
2676
2768
|
*
|
|
2677
2769
|
* @private
|
|
2678
2770
|
* @class
|
|
2679
|
-
* @
|
|
2680
|
-
* Chart object
|
|
2681
|
-
* @param {object} components
|
|
2682
|
-
* Map of component names to AccessibilityComponent objects.
|
|
2683
|
-
* @name Highcharts.KeyboardNavigation
|
|
2771
|
+
* @name Highcharts.MenuComponent
|
|
2684
2772
|
*/
|
|
2685
|
-
var
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
*
|
|
2690
|
-
* */
|
|
2691
|
-
function KeyboardNavigation(chart, components) {
|
|
2692
|
-
/* *
|
|
2693
|
-
*
|
|
2694
|
-
* Properties
|
|
2695
|
-
*
|
|
2696
|
-
* */
|
|
2697
|
-
this.chart = void 0;
|
|
2698
|
-
this.components = void 0;
|
|
2699
|
-
this.currentModuleIx = NaN;
|
|
2700
|
-
this.eventProvider = void 0;
|
|
2701
|
-
this.exitAnchor = void 0;
|
|
2702
|
-
this.modules = [];
|
|
2703
|
-
this.tabindexContainer = void 0;
|
|
2704
|
-
this.init(chart, components);
|
|
2773
|
+
var MenuComponent = /** @class */ (function (_super) {
|
|
2774
|
+
__extends(MenuComponent, _super);
|
|
2775
|
+
function MenuComponent() {
|
|
2776
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2705
2777
|
}
|
|
2706
2778
|
/* *
|
|
2707
2779
|
*
|
|
@@ -2710,330 +2782,244 @@
|
|
|
2710
2782
|
* */
|
|
2711
2783
|
/* eslint-disable valid-jsdoc */
|
|
2712
2784
|
/**
|
|
2713
|
-
*
|
|
2714
|
-
* @private
|
|
2715
|
-
* @param {Highcharts.Chart} chart
|
|
2716
|
-
* Chart object
|
|
2717
|
-
* @param {object} components
|
|
2718
|
-
* Map of component names to AccessibilityComponent objects.
|
|
2785
|
+
* Init the component
|
|
2719
2786
|
*/
|
|
2720
|
-
|
|
2721
|
-
var
|
|
2722
|
-
|
|
2723
|
-
this.chart
|
|
2724
|
-
|
|
2725
|
-
this.modules = [];
|
|
2726
|
-
this.currentModuleIx = 0;
|
|
2727
|
-
this.update();
|
|
2728
|
-
ep.addEvent(this.tabindexContainer, 'keydown', function (e) { return _this.onKeydown(e); });
|
|
2729
|
-
ep.addEvent(this.tabindexContainer, 'focus', function (e) { return _this.onFocus(e); });
|
|
2730
|
-
['mouseup', 'touchend'].forEach(function (eventName) {
|
|
2731
|
-
return ep.addEvent(doc, eventName, function () { return _this.onMouseUp(); });
|
|
2732
|
-
});
|
|
2733
|
-
['mousedown', 'touchstart'].forEach(function (eventName) {
|
|
2734
|
-
return ep.addEvent(chart.renderTo, eventName, function () {
|
|
2735
|
-
_this.isClickingChart = true;
|
|
2736
|
-
});
|
|
2737
|
-
});
|
|
2738
|
-
ep.addEvent(chart.renderTo, 'mouseover', function () {
|
|
2739
|
-
_this.pointerIsOverChart = true;
|
|
2787
|
+
MenuComponent.prototype.init = function () {
|
|
2788
|
+
var chart = this.chart,
|
|
2789
|
+
component = this;
|
|
2790
|
+
this.addEvent(chart, 'exportMenuShown', function () {
|
|
2791
|
+
component.onMenuShown();
|
|
2740
2792
|
});
|
|
2741
|
-
|
|
2742
|
-
|
|
2793
|
+
this.addEvent(chart, 'exportMenuHidden', function () {
|
|
2794
|
+
component.onMenuHidden();
|
|
2743
2795
|
});
|
|
2796
|
+
this.createProxyGroup();
|
|
2744
2797
|
};
|
|
2745
2798
|
/**
|
|
2746
|
-
*
|
|
2747
|
-
* @param {Array<string>} [order]
|
|
2748
|
-
* Array specifying the tab order of the components.
|
|
2799
|
+
* @private
|
|
2749
2800
|
*/
|
|
2750
|
-
|
|
2751
|
-
var
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
this.updateContainerTabindex();
|
|
2755
|
-
if (keyboardOptions &&
|
|
2756
|
-
keyboardOptions.enabled &&
|
|
2757
|
-
order &&
|
|
2758
|
-
order.length) {
|
|
2759
|
-
// We (still) have keyboard navigation. Update module list
|
|
2760
|
-
this.modules = order.reduce(function (modules, componentName) {
|
|
2761
|
-
var navModules = components[componentName].getKeyboardNavigation();
|
|
2762
|
-
return modules.concat(navModules);
|
|
2763
|
-
}, []);
|
|
2764
|
-
this.updateExitAnchor();
|
|
2765
|
-
}
|
|
2766
|
-
else {
|
|
2767
|
-
this.modules = [];
|
|
2768
|
-
this.currentModuleIx = 0;
|
|
2769
|
-
this.removeExitAnchor();
|
|
2801
|
+
MenuComponent.prototype.onMenuHidden = function () {
|
|
2802
|
+
var menu = this.chart.exportContextMenu;
|
|
2803
|
+
if (menu) {
|
|
2804
|
+
menu.setAttribute('aria-hidden', 'true');
|
|
2770
2805
|
}
|
|
2806
|
+
this.isExportMenuShown = false;
|
|
2807
|
+
this.setExportButtonExpandedState('false');
|
|
2771
2808
|
};
|
|
2772
2809
|
/**
|
|
2773
|
-
* Function to run on container focus
|
|
2774
2810
|
* @private
|
|
2775
|
-
* @param {global.FocusEvent} e Browser focus event.
|
|
2776
2811
|
*/
|
|
2777
|
-
|
|
2778
|
-
var chart = this.chart
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
!this.tabbingInBackwards &&
|
|
2784
|
-
!this.isClickingChart &&
|
|
2785
|
-
!focusComesFromChart &&
|
|
2786
|
-
this.modules[0]) {
|
|
2787
|
-
this.modules[0].init(1);
|
|
2812
|
+
MenuComponent.prototype.onMenuShown = function () {
|
|
2813
|
+
var chart = this.chart,
|
|
2814
|
+
menu = chart.exportContextMenu;
|
|
2815
|
+
if (menu) {
|
|
2816
|
+
this.addAccessibleContextMenuAttribs();
|
|
2817
|
+
unhideChartElementFromAT(chart, menu);
|
|
2788
2818
|
}
|
|
2789
|
-
this.
|
|
2819
|
+
this.isExportMenuShown = true;
|
|
2820
|
+
this.setExportButtonExpandedState('true');
|
|
2790
2821
|
};
|
|
2791
2822
|
/**
|
|
2792
|
-
* Reset chart navigation state if we click outside the chart and it's
|
|
2793
|
-
* not already reset.
|
|
2794
2823
|
* @private
|
|
2824
|
+
* @param {string} stateStr
|
|
2795
2825
|
*/
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
var chart = this.chart,
|
|
2800
|
-
curMod = this.modules &&
|
|
2801
|
-
this.modules[this.currentModuleIx || 0];
|
|
2802
|
-
if (curMod && curMod.terminate) {
|
|
2803
|
-
curMod.terminate();
|
|
2804
|
-
}
|
|
2805
|
-
if (chart.focusElement) {
|
|
2806
|
-
chart.focusElement.removeFocusBorder();
|
|
2807
|
-
}
|
|
2808
|
-
this.currentModuleIx = 0;
|
|
2809
|
-
this.keyboardReset = true;
|
|
2826
|
+
MenuComponent.prototype.setExportButtonExpandedState = function (stateStr) {
|
|
2827
|
+
if (this.exportButtonProxy) {
|
|
2828
|
+
this.exportButtonProxy.buttonElement.setAttribute('aria-expanded', stateStr);
|
|
2810
2829
|
}
|
|
2811
2830
|
};
|
|
2812
2831
|
/**
|
|
2813
|
-
*
|
|
2814
|
-
*
|
|
2815
|
-
* @param {global.KeyboardEvent} ev Browser keydown event.
|
|
2832
|
+
* Called on each render of the chart. We need to update positioning of the
|
|
2833
|
+
* proxy overlay.
|
|
2816
2834
|
*/
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
this.modules.length &&
|
|
2821
|
-
this.modules[this.currentModuleIx]);
|
|
2822
|
-
var preventDefault;
|
|
2823
|
-
// Used for resetting nav state when clicking outside chart
|
|
2824
|
-
this.keyboardReset = false;
|
|
2825
|
-
// Used for sending focus out of the chart by the modules.
|
|
2826
|
-
this.exiting = false;
|
|
2827
|
-
// If there is a nav module for the current index, run it.
|
|
2828
|
-
// Otherwise, we are outside of the chart in some direction.
|
|
2829
|
-
if (curNavModule) {
|
|
2830
|
-
var response = curNavModule.run(e);
|
|
2831
|
-
if (response === curNavModule.response.success) {
|
|
2832
|
-
preventDefault = true;
|
|
2833
|
-
}
|
|
2834
|
-
else if (response === curNavModule.response.prev) {
|
|
2835
|
-
preventDefault = this.prev();
|
|
2836
|
-
}
|
|
2837
|
-
else if (response === curNavModule.response.next) {
|
|
2838
|
-
preventDefault = this.next();
|
|
2839
|
-
}
|
|
2840
|
-
if (preventDefault) {
|
|
2841
|
-
e.preventDefault();
|
|
2842
|
-
e.stopPropagation();
|
|
2843
|
-
}
|
|
2844
|
-
}
|
|
2835
|
+
MenuComponent.prototype.onChartRender = function () {
|
|
2836
|
+
this.proxyProvider.clearGroup('chartMenu');
|
|
2837
|
+
this.proxyMenuButton();
|
|
2845
2838
|
};
|
|
2846
2839
|
/**
|
|
2847
|
-
* Go to previous module.
|
|
2848
2840
|
* @private
|
|
2849
2841
|
*/
|
|
2850
|
-
|
|
2851
|
-
|
|
2842
|
+
MenuComponent.prototype.proxyMenuButton = function () {
|
|
2843
|
+
var chart = this.chart;
|
|
2844
|
+
var proxyProvider = this.proxyProvider;
|
|
2845
|
+
var buttonEl = getExportMenuButtonElement(chart);
|
|
2846
|
+
if (exportingShouldHaveA11y(chart) && buttonEl) {
|
|
2847
|
+
this.exportButtonProxy = proxyProvider.addProxyElement('chartMenu', { click: buttonEl }, {
|
|
2848
|
+
'aria-label': chart.langFormat('accessibility.exporting.menuButtonLabel', {
|
|
2849
|
+
chart: chart,
|
|
2850
|
+
chartTitle: getChartTitle(chart)
|
|
2851
|
+
}),
|
|
2852
|
+
'aria-expanded': false
|
|
2853
|
+
});
|
|
2854
|
+
}
|
|
2852
2855
|
};
|
|
2853
2856
|
/**
|
|
2854
|
-
* Go to next module.
|
|
2855
2857
|
* @private
|
|
2856
2858
|
*/
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
+
MenuComponent.prototype.createProxyGroup = function () {
|
|
2860
|
+
var chart = this.chart;
|
|
2861
|
+
if (chart && this.proxyProvider) {
|
|
2862
|
+
this.proxyProvider.addGroup('chartMenu', 'div');
|
|
2863
|
+
}
|
|
2859
2864
|
};
|
|
2860
2865
|
/**
|
|
2861
|
-
* Move to prev/next module.
|
|
2862
2866
|
* @private
|
|
2863
|
-
* @param {number} direction
|
|
2864
|
-
* Direction to move. +1 for next, -1 for prev.
|
|
2865
|
-
* @return {boolean}
|
|
2866
|
-
* True if there was a valid module in direction.
|
|
2867
2867
|
*/
|
|
2868
|
-
|
|
2869
|
-
var
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2868
|
+
MenuComponent.prototype.addAccessibleContextMenuAttribs = function () {
|
|
2869
|
+
var chart = this.chart,
|
|
2870
|
+
exportList = chart.exportDivElements;
|
|
2871
|
+
if (exportList && exportList.length) {
|
|
2872
|
+
// Set tabindex on the menu items to allow focusing by script
|
|
2873
|
+
// Set role to give screen readers a chance to pick up the contents
|
|
2874
|
+
exportList.forEach(function (item) {
|
|
2875
|
+
if (item) {
|
|
2876
|
+
if (item.tagName === 'LI' &&
|
|
2877
|
+
!(item.children && item.children.length)) {
|
|
2878
|
+
item.setAttribute('tabindex', -1);
|
|
2879
|
+
}
|
|
2880
|
+
else {
|
|
2881
|
+
item.setAttribute('aria-hidden', 'true');
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
});
|
|
2885
|
+
// Set accessibility properties on parent div
|
|
2886
|
+
var parentDiv = (exportList[0] && exportList[0].parentNode);
|
|
2887
|
+
if (parentDiv) {
|
|
2888
|
+
attr(parentDiv, {
|
|
2889
|
+
'aria-hidden': void 0,
|
|
2890
|
+
'aria-label': chart.langFormat('accessibility.exporting.chartMenuLabel', { chart: chart }),
|
|
2891
|
+
role: 'list' // Needed for webkit/VO
|
|
2892
|
+
});
|
|
2886
2893
|
}
|
|
2887
2894
|
}
|
|
2888
|
-
// No module
|
|
2889
|
-
this.currentModuleIx = 0; // Reset counter
|
|
2890
|
-
// Set focus to chart or exit anchor depending on direction
|
|
2891
|
-
this.exiting = true;
|
|
2892
|
-
if (direction > 0) {
|
|
2893
|
-
this.exitAnchor.focus();
|
|
2894
|
-
}
|
|
2895
|
-
else {
|
|
2896
|
-
this.tabindexContainer.focus();
|
|
2897
|
-
}
|
|
2898
|
-
return false;
|
|
2899
2895
|
};
|
|
2900
2896
|
/**
|
|
2901
|
-
*
|
|
2902
|
-
*
|
|
2903
|
-
* also use this when users come back into the chart by tabbing back, in
|
|
2904
|
-
* order to navigate from the end of the chart.
|
|
2905
|
-
* @private
|
|
2897
|
+
* Get keyboard navigation handler for this component.
|
|
2898
|
+
* @return {Highcharts.KeyboardNavigationHandler}
|
|
2906
2899
|
*/
|
|
2907
|
-
|
|
2908
|
-
var
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2900
|
+
MenuComponent.prototype.getKeyboardNavigation = function () {
|
|
2901
|
+
var keys = this.keyCodes,
|
|
2902
|
+
chart = this.chart,
|
|
2903
|
+
component = this;
|
|
2904
|
+
return new KeyboardNavigationHandler(chart, {
|
|
2905
|
+
keyCodeMap: [
|
|
2906
|
+
// Arrow prev handler
|
|
2907
|
+
[
|
|
2908
|
+
[keys.left, keys.up],
|
|
2909
|
+
function () {
|
|
2910
|
+
return component.onKbdPrevious(this);
|
|
2911
|
+
}
|
|
2912
|
+
],
|
|
2913
|
+
// Arrow next handler
|
|
2914
|
+
[
|
|
2915
|
+
[keys.right, keys.down],
|
|
2916
|
+
function () {
|
|
2917
|
+
return component.onKbdNext(this);
|
|
2918
|
+
}
|
|
2919
|
+
],
|
|
2920
|
+
// Click handler
|
|
2921
|
+
[
|
|
2922
|
+
[keys.enter, keys.space],
|
|
2923
|
+
function () {
|
|
2924
|
+
return component.onKbdClick(this);
|
|
2925
|
+
}
|
|
2926
|
+
]
|
|
2927
|
+
],
|
|
2928
|
+
// Only run exporting navigation if exporting support exists and is
|
|
2929
|
+
// enabled on chart
|
|
2930
|
+
validate: function () {
|
|
2931
|
+
return !!chart.exporting &&
|
|
2932
|
+
chart.options.exporting.enabled !== false &&
|
|
2933
|
+
chart.options.exporting.accessibility.enabled !==
|
|
2934
|
+
false;
|
|
2935
|
+
},
|
|
2936
|
+
// Focus export menu button
|
|
2937
|
+
init: function () {
|
|
2938
|
+
var proxy = component.exportButtonProxy;
|
|
2939
|
+
var svgEl = component.chart.exportingGroup;
|
|
2940
|
+
if (proxy && svgEl) {
|
|
2941
|
+
chart.setFocusToElement(svgEl, proxy.buttonElement);
|
|
2942
|
+
}
|
|
2943
|
+
},
|
|
2944
|
+
// Hide the menu
|
|
2945
|
+
terminate: function () {
|
|
2946
|
+
chart.hideExportMenu();
|
|
2947
|
+
}
|
|
2948
|
+
});
|
|
2918
2949
|
};
|
|
2919
2950
|
/**
|
|
2920
|
-
* Chart container should have tabindex if navigation is enabled.
|
|
2921
2951
|
* @private
|
|
2952
|
+
* @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler
|
|
2953
|
+
* @return {number} Response code
|
|
2922
2954
|
*/
|
|
2923
|
-
|
|
2924
|
-
var
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
var
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
else {
|
|
2935
|
-
tabindexContainer = container;
|
|
2936
|
-
}
|
|
2937
|
-
this.tabindexContainer = tabindexContainer;
|
|
2938
|
-
var curTabindex = tabindexContainer.getAttribute('tabindex');
|
|
2939
|
-
if (shouldHaveTabindex && !curTabindex) {
|
|
2940
|
-
tabindexContainer.setAttribute('tabindex', '0');
|
|
2941
|
-
}
|
|
2942
|
-
else if (!shouldHaveTabindex) {
|
|
2943
|
-
chart.container.removeAttribute('tabindex');
|
|
2955
|
+
MenuComponent.prototype.onKbdPrevious = function (keyboardNavigationHandler) {
|
|
2956
|
+
var chart = this.chart;
|
|
2957
|
+
var a11yOptions = chart.options.accessibility;
|
|
2958
|
+
var response = keyboardNavigationHandler.response;
|
|
2959
|
+
// Try to highlight prev item in list. Highlighting e.g.
|
|
2960
|
+
// separators will fail.
|
|
2961
|
+
var i = chart.highlightedExportItemIx || 0;
|
|
2962
|
+
while (i--) {
|
|
2963
|
+
if (chart.highlightExportItem(i)) {
|
|
2964
|
+
return response.success;
|
|
2965
|
+
}
|
|
2944
2966
|
}
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
KeyboardNavigation.prototype.makeElementAnExitAnchor = function (el) {
|
|
2950
|
-
var chartTabindex = this.tabindexContainer.getAttribute('tabindex') || 0;
|
|
2951
|
-
el.setAttribute('class', 'highcharts-exit-anchor');
|
|
2952
|
-
el.setAttribute('tabindex', chartTabindex);
|
|
2953
|
-
el.setAttribute('aria-hidden', false);
|
|
2954
|
-
// Handle focus
|
|
2955
|
-
this.addExitAnchorEventsToEl(el);
|
|
2956
|
-
};
|
|
2957
|
-
/**
|
|
2958
|
-
* Add new exit anchor to the chart.
|
|
2959
|
-
*
|
|
2960
|
-
* @private
|
|
2961
|
-
*/
|
|
2962
|
-
KeyboardNavigation.prototype.createExitAnchor = function () {
|
|
2963
|
-
var chart = this.chart,
|
|
2964
|
-
exitAnchor = this.exitAnchor = doc.createElement('div');
|
|
2965
|
-
chart.renderTo.appendChild(exitAnchor);
|
|
2966
|
-
this.makeElementAnExitAnchor(exitAnchor);
|
|
2967
|
-
};
|
|
2968
|
-
/**
|
|
2969
|
-
* @private
|
|
2970
|
-
*/
|
|
2971
|
-
KeyboardNavigation.prototype.removeExitAnchor = function () {
|
|
2972
|
-
if (this.exitAnchor && this.exitAnchor.parentNode) {
|
|
2973
|
-
this.exitAnchor.parentNode
|
|
2974
|
-
.removeChild(this.exitAnchor);
|
|
2975
|
-
delete this.exitAnchor;
|
|
2967
|
+
// We failed, so wrap around or move to prev module
|
|
2968
|
+
if (a11yOptions.keyboardNavigation.wrapAround) {
|
|
2969
|
+
chart.highlightLastExportItem();
|
|
2970
|
+
return response.success;
|
|
2976
2971
|
}
|
|
2972
|
+
return response.prev;
|
|
2977
2973
|
};
|
|
2978
2974
|
/**
|
|
2979
2975
|
* @private
|
|
2976
|
+
* @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler
|
|
2977
|
+
* @return {number} Response code
|
|
2980
2978
|
*/
|
|
2981
|
-
|
|
2982
|
-
var chart = this.chart
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
// Focus the container instead
|
|
2991
|
-
keyboardNavigation.tabbingInBackwards = true;
|
|
2992
|
-
keyboardNavigation.tabindexContainer.focus();
|
|
2993
|
-
delete keyboardNavigation.tabbingInBackwards;
|
|
2994
|
-
e.preventDefault();
|
|
2995
|
-
// Move to last valid keyboard nav module
|
|
2996
|
-
// Note the we don't run it, just set the index
|
|
2997
|
-
if (keyboardNavigation.modules &&
|
|
2998
|
-
keyboardNavigation.modules.length) {
|
|
2999
|
-
keyboardNavigation.currentModuleIx =
|
|
3000
|
-
keyboardNavigation.modules.length - 1;
|
|
3001
|
-
var curModule = keyboardNavigation.modules[keyboardNavigation.currentModuleIx];
|
|
3002
|
-
// Validate the module
|
|
3003
|
-
if (curModule &&
|
|
3004
|
-
curModule.validate && !curModule.validate()) {
|
|
3005
|
-
// Invalid. Try moving backwards to find next valid.
|
|
3006
|
-
keyboardNavigation.prev();
|
|
3007
|
-
}
|
|
3008
|
-
else if (curModule) {
|
|
3009
|
-
// We have a valid module, init it
|
|
3010
|
-
curModule.init(-1);
|
|
3011
|
-
}
|
|
3012
|
-
}
|
|
3013
|
-
}
|
|
3014
|
-
else {
|
|
3015
|
-
// Don't skip the next focus, we only skip once.
|
|
3016
|
-
keyboardNavigation.exiting = false;
|
|
2979
|
+
MenuComponent.prototype.onKbdNext = function (keyboardNavigationHandler) {
|
|
2980
|
+
var chart = this.chart;
|
|
2981
|
+
var a11yOptions = chart.options.accessibility;
|
|
2982
|
+
var response = keyboardNavigationHandler.response;
|
|
2983
|
+
// Try to highlight next item in list. Highlighting e.g.
|
|
2984
|
+
// separators will fail.
|
|
2985
|
+
for (var i = (chart.highlightedExportItemIx || 0) + 1; i < chart.exportDivElements.length; ++i) {
|
|
2986
|
+
if (chart.highlightExportItem(i)) {
|
|
2987
|
+
return response.success;
|
|
3017
2988
|
}
|
|
3018
|
-
}
|
|
2989
|
+
}
|
|
2990
|
+
// We failed, so wrap around or move to next module
|
|
2991
|
+
if (a11yOptions.keyboardNavigation.wrapAround) {
|
|
2992
|
+
chart.highlightExportItem(0);
|
|
2993
|
+
return response.success;
|
|
2994
|
+
}
|
|
2995
|
+
return response.next;
|
|
3019
2996
|
};
|
|
3020
2997
|
/**
|
|
3021
|
-
* Remove all traces of keyboard navigation.
|
|
3022
2998
|
* @private
|
|
2999
|
+
* @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler
|
|
3000
|
+
* @return {number} Response code
|
|
3023
3001
|
*/
|
|
3024
|
-
|
|
3025
|
-
this.
|
|
3026
|
-
|
|
3027
|
-
|
|
3002
|
+
MenuComponent.prototype.onKbdClick = function (keyboardNavigationHandler) {
|
|
3003
|
+
var chart = this.chart;
|
|
3004
|
+
var curHighlightedItem = chart.exportDivElements[chart.highlightedExportItemIx];
|
|
3005
|
+
var exportButtonElement = getExportMenuButtonElement(chart).element;
|
|
3006
|
+
if (this.isExportMenuShown) {
|
|
3007
|
+
this.fakeClickEvent(curHighlightedItem);
|
|
3008
|
+
}
|
|
3009
|
+
else {
|
|
3010
|
+
this.fakeClickEvent(exportButtonElement);
|
|
3011
|
+
chart.highlightExportItem(0);
|
|
3012
|
+
}
|
|
3013
|
+
return keyboardNavigationHandler.response.success;
|
|
3028
3014
|
};
|
|
3029
|
-
return
|
|
3030
|
-
}());
|
|
3015
|
+
return MenuComponent;
|
|
3016
|
+
}(AccessibilityComponent));
|
|
3031
3017
|
/* *
|
|
3032
3018
|
*
|
|
3033
3019
|
* Class Namespace
|
|
3034
3020
|
*
|
|
3035
3021
|
* */
|
|
3036
|
-
(function (
|
|
3022
|
+
(function (MenuComponent) {
|
|
3037
3023
|
/* *
|
|
3038
3024
|
*
|
|
3039
3025
|
* Declarations
|
|
@@ -3041,10 +3027,10 @@
|
|
|
3041
3027
|
* */
|
|
3042
3028
|
/* *
|
|
3043
3029
|
*
|
|
3044
|
-
*
|
|
3030
|
+
* Constants
|
|
3045
3031
|
*
|
|
3046
3032
|
* */
|
|
3047
|
-
var
|
|
3033
|
+
var composedClasses = [];
|
|
3048
3034
|
/* *
|
|
3049
3035
|
*
|
|
3050
3036
|
* Functions
|
|
@@ -3055,717 +3041,865 @@
|
|
|
3055
3041
|
* @private
|
|
3056
3042
|
*/
|
|
3057
3043
|
function compose(ChartClass) {
|
|
3058
|
-
if (
|
|
3059
|
-
|
|
3060
|
-
var chartProto =
|
|
3061
|
-
chartProto.
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
addEvent(doc, 'keydown', documentOnKeydown);
|
|
3044
|
+
if (composedClasses.indexOf(ChartClass) === -1) {
|
|
3045
|
+
composedClasses.push(ChartClass);
|
|
3046
|
+
var chartProto = Chart.prototype;
|
|
3047
|
+
chartProto.hideExportMenu = chartHideExportMenu;
|
|
3048
|
+
chartProto.highlightExportItem = chartHighlightExportItem;
|
|
3049
|
+
chartProto.highlightLastExportItem = chartHighlightLastExportItem;
|
|
3050
|
+
chartProto.showExportMenu = chartShowExportMenu;
|
|
3066
3051
|
}
|
|
3067
|
-
return ChartClass;
|
|
3068
3052
|
}
|
|
3069
|
-
|
|
3053
|
+
MenuComponent.compose = compose;
|
|
3070
3054
|
/**
|
|
3071
|
-
*
|
|
3055
|
+
* Show the export menu and focus the first item (if exists).
|
|
3056
|
+
*
|
|
3072
3057
|
* @private
|
|
3058
|
+
* @function Highcharts.Chart#showExportMenu
|
|
3073
3059
|
*/
|
|
3074
|
-
function
|
|
3075
|
-
var
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3060
|
+
function chartShowExportMenu() {
|
|
3061
|
+
var exportButton = getExportMenuButtonElement(this);
|
|
3062
|
+
if (exportButton) {
|
|
3063
|
+
var el = exportButton.element;
|
|
3064
|
+
if (el.onclick) {
|
|
3065
|
+
el.onclick(getFakeMouseEvent('click'));
|
|
3079
3066
|
}
|
|
3080
|
-
|
|
3081
|
-
});
|
|
3067
|
+
}
|
|
3082
3068
|
}
|
|
3083
3069
|
/**
|
|
3084
|
-
* Add event listener to document to detect ESC key press and dismiss
|
|
3085
|
-
* hover/popup content.
|
|
3086
3070
|
* @private
|
|
3071
|
+
* @function Highcharts.Chart#hideExportMenu
|
|
3087
3072
|
*/
|
|
3088
|
-
function
|
|
3089
|
-
var
|
|
3090
|
-
|
|
3091
|
-
if (
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3073
|
+
function chartHideExportMenu() {
|
|
3074
|
+
var chart = this,
|
|
3075
|
+
exportList = chart.exportDivElements;
|
|
3076
|
+
if (exportList && chart.exportContextMenu) {
|
|
3077
|
+
// Reset hover states etc.
|
|
3078
|
+
exportList.forEach(function (el) {
|
|
3079
|
+
if (el &&
|
|
3080
|
+
el.className === 'highcharts-menu-item' &&
|
|
3081
|
+
el.onmouseout) {
|
|
3082
|
+
el.onmouseout(getFakeMouseEvent('mouseout'));
|
|
3095
3083
|
}
|
|
3096
3084
|
});
|
|
3085
|
+
chart.highlightedExportItemIx = 0;
|
|
3086
|
+
// Hide the menu div
|
|
3087
|
+
chart.exportContextMenu.hideMenu();
|
|
3088
|
+
// Make sure the chart has focus and can capture keyboard events
|
|
3089
|
+
chart.container.focus();
|
|
3097
3090
|
}
|
|
3098
3091
|
}
|
|
3099
|
-
|
|
3092
|
+
/**
|
|
3093
|
+
* Highlight export menu item by index.
|
|
3094
|
+
*
|
|
3095
|
+
* @private
|
|
3096
|
+
* @function Highcharts.Chart#highlightExportItem
|
|
3097
|
+
*
|
|
3098
|
+
* @param {number} ix
|
|
3099
|
+
*
|
|
3100
|
+
* @return {boolean}
|
|
3101
|
+
*/
|
|
3102
|
+
function chartHighlightExportItem(ix) {
|
|
3103
|
+
var listItem = this.exportDivElements && this.exportDivElements[ix];
|
|
3104
|
+
var curHighlighted = this.exportDivElements &&
|
|
3105
|
+
this.exportDivElements[this.highlightedExportItemIx];
|
|
3106
|
+
if (listItem &&
|
|
3107
|
+
listItem.tagName === 'LI' &&
|
|
3108
|
+
!(listItem.children && listItem.children.length)) {
|
|
3109
|
+
// Test if we have focus support for SVG elements
|
|
3110
|
+
var hasSVGFocusSupport = !!(this.renderTo.getElementsByTagName('g')[0] || {}).focus;
|
|
3111
|
+
// Only focus if we can set focus back to the elements after
|
|
3112
|
+
// destroying the menu (#7422)
|
|
3113
|
+
if (listItem.focus && hasSVGFocusSupport) {
|
|
3114
|
+
listItem.focus();
|
|
3115
|
+
}
|
|
3116
|
+
if (curHighlighted && curHighlighted.onmouseout) {
|
|
3117
|
+
curHighlighted.onmouseout(getFakeMouseEvent('mouseout'));
|
|
3118
|
+
}
|
|
3119
|
+
if (listItem.onmouseover) {
|
|
3120
|
+
listItem.onmouseover(getFakeMouseEvent('mouseover'));
|
|
3121
|
+
}
|
|
3122
|
+
this.highlightedExportItemIx = ix;
|
|
3123
|
+
return true;
|
|
3124
|
+
}
|
|
3125
|
+
return false;
|
|
3126
|
+
}
|
|
3127
|
+
/**
|
|
3128
|
+
* Try to highlight the last valid export menu item.
|
|
3129
|
+
*
|
|
3130
|
+
* @private
|
|
3131
|
+
* @function Highcharts.Chart#highlightLastExportItem
|
|
3132
|
+
* @return {boolean}
|
|
3133
|
+
*/
|
|
3134
|
+
function chartHighlightLastExportItem() {
|
|
3135
|
+
var chart = this;
|
|
3136
|
+
if (chart.exportDivElements) {
|
|
3137
|
+
var i = chart.exportDivElements.length;
|
|
3138
|
+
while (i--) {
|
|
3139
|
+
if (chart.highlightExportItem(i)) {
|
|
3140
|
+
return true;
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
return false;
|
|
3145
|
+
}
|
|
3146
|
+
})(MenuComponent || (MenuComponent = {}));
|
|
3100
3147
|
/* *
|
|
3101
3148
|
*
|
|
3102
3149
|
* Default Export
|
|
3103
3150
|
*
|
|
3104
3151
|
* */
|
|
3105
3152
|
|
|
3106
|
-
return
|
|
3153
|
+
return MenuComponent;
|
|
3107
3154
|
});
|
|
3108
|
-
_registerModule(_modules, 'Accessibility/
|
|
3155
|
+
_registerModule(_modules, 'Accessibility/KeyboardNavigation.js', [_modules['Core/Globals.js'], _modules['Accessibility/Components/MenuComponent.js'], _modules['Core/Utilities.js'], _modules['Accessibility/Utils/EventProvider.js'], _modules['Accessibility/Utils/HTMLUtilities.js']], function (H, MenuComponent, U, EventProvider, HTMLUtilities) {
|
|
3109
3156
|
/* *
|
|
3110
3157
|
*
|
|
3111
3158
|
* (c) 2009-2021 Øystein Moseng
|
|
3112
3159
|
*
|
|
3113
|
-
*
|
|
3160
|
+
* Main keyboard navigation handling.
|
|
3114
3161
|
*
|
|
3115
3162
|
* License: www.highcharts.com/license
|
|
3116
3163
|
*
|
|
3117
3164
|
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
3118
3165
|
*
|
|
3119
3166
|
* */
|
|
3120
|
-
var
|
|
3167
|
+
var doc = H.doc,
|
|
3168
|
+
win = H.win;
|
|
3121
3169
|
var addEvent = U.addEvent,
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
pick = U.pick,
|
|
3126
|
-
syncTimeout = U.syncTimeout;
|
|
3127
|
-
var stripHTMLTags = HTMLUtilities.stripHTMLTagsFromString,
|
|
3128
|
-
addClass = HTMLUtilities.addClass,
|
|
3129
|
-
removeClass = HTMLUtilities.removeClass;
|
|
3130
|
-
var getChartTitle = ChartUtils.getChartTitle;
|
|
3131
|
-
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
3132
|
-
/**
|
|
3133
|
-
* @private
|
|
3134
|
-
*/
|
|
3135
|
-
function scrollLegendToItem(legend, itemIx) {
|
|
3136
|
-
var itemPage = legend.allItems[itemIx].pageIx,
|
|
3137
|
-
curPage = legend.currentPage;
|
|
3138
|
-
if (typeof itemPage !== 'undefined' && itemPage + 1 !== curPage) {
|
|
3139
|
-
legend.scroll(1 + itemPage - curPage);
|
|
3140
|
-
}
|
|
3141
|
-
}
|
|
3142
|
-
/**
|
|
3143
|
-
* @private
|
|
3144
|
-
*/
|
|
3145
|
-
function shouldDoLegendA11y(chart) {
|
|
3146
|
-
var items = chart.legend && chart.legend.allItems,
|
|
3147
|
-
legendA11yOptions = (chart.options.legend.accessibility || {});
|
|
3148
|
-
return !!(items && items.length &&
|
|
3149
|
-
!(chart.colorAxis && chart.colorAxis.length) &&
|
|
3150
|
-
legendA11yOptions.enabled !== false);
|
|
3151
|
-
}
|
|
3152
|
-
/**
|
|
3153
|
-
* Highlight legend item by index.
|
|
3170
|
+
fireEvent = U.fireEvent;
|
|
3171
|
+
var getElement = HTMLUtilities.getElement;
|
|
3172
|
+
/* *
|
|
3154
3173
|
*
|
|
3155
|
-
*
|
|
3156
|
-
* @function Highcharts.Chart#highlightLegendItem
|
|
3174
|
+
* Class
|
|
3157
3175
|
*
|
|
3158
|
-
*
|
|
3176
|
+
* */
|
|
3177
|
+
/**
|
|
3178
|
+
* The KeyboardNavigation class, containing the overall keyboard navigation
|
|
3179
|
+
* logic for the chart.
|
|
3159
3180
|
*
|
|
3160
|
-
* @
|
|
3181
|
+
* @requires module:modules/accessibility
|
|
3182
|
+
*
|
|
3183
|
+
* @private
|
|
3184
|
+
* @class
|
|
3185
|
+
* @param {Highcharts.Chart} chart
|
|
3186
|
+
* Chart object
|
|
3187
|
+
* @param {object} components
|
|
3188
|
+
* Map of component names to AccessibilityComponent objects.
|
|
3189
|
+
* @name Highcharts.KeyboardNavigation
|
|
3161
3190
|
*/
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
return false;
|
|
3183
|
-
};
|
|
3184
|
-
// Keep track of pressed state for legend items
|
|
3185
|
-
addEvent(Legend, 'afterColorizeItem', function (e) {
|
|
3186
|
-
var chart = this.chart,
|
|
3187
|
-
a11yOptions = chart.options.accessibility,
|
|
3188
|
-
legendItem = e.item;
|
|
3189
|
-
if (a11yOptions.enabled && legendItem && legendItem.a11yProxyElement) {
|
|
3190
|
-
legendItem.a11yProxyElement.buttonElement.setAttribute('aria-pressed', e.visible ? 'true' : 'false');
|
|
3191
|
+
var KeyboardNavigation = /** @class */ (function () {
|
|
3192
|
+
/* *
|
|
3193
|
+
*
|
|
3194
|
+
* Constructor
|
|
3195
|
+
*
|
|
3196
|
+
* */
|
|
3197
|
+
function KeyboardNavigation(chart, components) {
|
|
3198
|
+
/* *
|
|
3199
|
+
*
|
|
3200
|
+
* Properties
|
|
3201
|
+
*
|
|
3202
|
+
* */
|
|
3203
|
+
this.chart = void 0;
|
|
3204
|
+
this.components = void 0;
|
|
3205
|
+
this.currentModuleIx = NaN;
|
|
3206
|
+
this.eventProvider = void 0;
|
|
3207
|
+
this.exitAnchor = void 0;
|
|
3208
|
+
this.modules = [];
|
|
3209
|
+
this.tabindexContainer = void 0;
|
|
3210
|
+
this.init(chart, components);
|
|
3191
3211
|
}
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
* @name Highcharts.LegendComponent
|
|
3199
|
-
*/
|
|
3200
|
-
var LegendComponent = function () { };
|
|
3201
|
-
LegendComponent.prototype = new AccessibilityComponent();
|
|
3202
|
-
extend(LegendComponent.prototype, /** @lends Highcharts.LegendComponent */ {
|
|
3212
|
+
/* *
|
|
3213
|
+
*
|
|
3214
|
+
* Functions
|
|
3215
|
+
*
|
|
3216
|
+
* */
|
|
3217
|
+
/* eslint-disable valid-jsdoc */
|
|
3203
3218
|
/**
|
|
3204
|
-
*
|
|
3219
|
+
* Initialize the class
|
|
3205
3220
|
* @private
|
|
3221
|
+
* @param {Highcharts.Chart} chart
|
|
3222
|
+
* Chart object
|
|
3223
|
+
* @param {object} components
|
|
3224
|
+
* Map of component names to AccessibilityComponent objects.
|
|
3206
3225
|
*/
|
|
3207
|
-
init
|
|
3208
|
-
var
|
|
3209
|
-
this.
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
this.
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
}
|
|
3226
|
+
KeyboardNavigation.prototype.init = function (chart, components) {
|
|
3227
|
+
var _this = this;
|
|
3228
|
+
var ep = this.eventProvider = new EventProvider();
|
|
3229
|
+
this.chart = chart;
|
|
3230
|
+
this.components = components;
|
|
3231
|
+
this.modules = [];
|
|
3232
|
+
this.currentModuleIx = 0;
|
|
3233
|
+
this.update();
|
|
3234
|
+
ep.addEvent(this.tabindexContainer, 'keydown', function (e) { return _this.onKeydown(e); });
|
|
3235
|
+
ep.addEvent(this.tabindexContainer, 'focus', function (e) { return _this.onFocus(e); });
|
|
3236
|
+
['mouseup', 'touchend'].forEach(function (eventName) {
|
|
3237
|
+
return ep.addEvent(doc, eventName, function () { return _this.onMouseUp(); });
|
|
3220
3238
|
});
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
}
|
|
3239
|
+
['mousedown', 'touchstart'].forEach(function (eventName) {
|
|
3240
|
+
return ep.addEvent(chart.renderTo, eventName, function () {
|
|
3241
|
+
_this.isClickingChart = true;
|
|
3242
|
+
});
|
|
3225
3243
|
});
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
this.chart.renderer &&
|
|
3229
|
-
component.recreateProxies()) {
|
|
3230
|
-
syncTimeout(function () { return component.proxyProvider.updateGroupProxyElementPositions('legend'); }, animObject(pick(this.chart.renderer.globalAnimation, true)).duration);
|
|
3231
|
-
}
|
|
3244
|
+
ep.addEvent(chart.renderTo, 'mouseover', function () {
|
|
3245
|
+
_this.pointerIsOverChart = true;
|
|
3232
3246
|
});
|
|
3233
|
-
|
|
3247
|
+
ep.addEvent(chart.renderTo, 'mouseout', function () {
|
|
3248
|
+
_this.pointerIsOverChart = false;
|
|
3249
|
+
});
|
|
3250
|
+
};
|
|
3234
3251
|
/**
|
|
3235
|
-
* Update
|
|
3252
|
+
* Update the modules for the keyboard navigation.
|
|
3253
|
+
* @param {Array<string>} [order]
|
|
3254
|
+
* Array specifying the tab order of the components.
|
|
3255
|
+
*/
|
|
3256
|
+
KeyboardNavigation.prototype.update = function (order) {
|
|
3257
|
+
var a11yOptions = this.chart.options.accessibility,
|
|
3258
|
+
keyboardOptions = a11yOptions && a11yOptions.keyboardNavigation,
|
|
3259
|
+
components = this.components;
|
|
3260
|
+
this.updateContainerTabindex();
|
|
3261
|
+
if (keyboardOptions &&
|
|
3262
|
+
keyboardOptions.enabled &&
|
|
3263
|
+
order &&
|
|
3264
|
+
order.length) {
|
|
3265
|
+
// We (still) have keyboard navigation. Update module list
|
|
3266
|
+
this.modules = order.reduce(function (modules, componentName) {
|
|
3267
|
+
var navModules = components[componentName].getKeyboardNavigation();
|
|
3268
|
+
return modules.concat(navModules);
|
|
3269
|
+
}, []);
|
|
3270
|
+
this.updateExitAnchor();
|
|
3271
|
+
}
|
|
3272
|
+
else {
|
|
3273
|
+
this.modules = [];
|
|
3274
|
+
this.currentModuleIx = 0;
|
|
3275
|
+
this.removeExitAnchor();
|
|
3276
|
+
}
|
|
3277
|
+
};
|
|
3278
|
+
/**
|
|
3279
|
+
* Function to run on container focus
|
|
3236
3280
|
* @private
|
|
3281
|
+
* @param {global.FocusEvent} e Browser focus event.
|
|
3237
3282
|
*/
|
|
3238
|
-
|
|
3283
|
+
KeyboardNavigation.prototype.onFocus = function (e) {
|
|
3239
3284
|
var chart = this.chart;
|
|
3240
|
-
var
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
var h = item.legendItem ? Math.round(item.legendItem.getBBox().height) : 0;
|
|
3253
|
-
hide = y + h - legend.pages[itemPage] > clipHeight || itemPage !== curPage - 1;
|
|
3254
|
-
}
|
|
3255
|
-
if (hide) {
|
|
3256
|
-
if (chart.styledMode) {
|
|
3257
|
-
addClass(proxyEl, 'highcharts-a11y-invisible');
|
|
3258
|
-
}
|
|
3259
|
-
else {
|
|
3260
|
-
proxyEl.style.visibility = 'hidden';
|
|
3261
|
-
}
|
|
3262
|
-
}
|
|
3263
|
-
else {
|
|
3264
|
-
removeClass(proxyEl, 'highcharts-a11y-invisible');
|
|
3265
|
-
proxyEl.style.visibility = '';
|
|
3266
|
-
}
|
|
3267
|
-
}
|
|
3268
|
-
});
|
|
3269
|
-
},
|
|
3285
|
+
var focusComesFromChart = (e.relatedTarget &&
|
|
3286
|
+
chart.container.contains(e.relatedTarget));
|
|
3287
|
+
// Init keyboard nav if tabbing into chart
|
|
3288
|
+
if (!this.exiting &&
|
|
3289
|
+
!this.tabbingInBackwards &&
|
|
3290
|
+
!this.isClickingChart &&
|
|
3291
|
+
!focusComesFromChart &&
|
|
3292
|
+
this.modules[0]) {
|
|
3293
|
+
this.modules[0].init(1);
|
|
3294
|
+
}
|
|
3295
|
+
this.exiting = false;
|
|
3296
|
+
};
|
|
3270
3297
|
/**
|
|
3298
|
+
* Reset chart navigation state if we click outside the chart and it's
|
|
3299
|
+
* not already reset.
|
|
3271
3300
|
* @private
|
|
3272
3301
|
*/
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3302
|
+
KeyboardNavigation.prototype.onMouseUp = function () {
|
|
3303
|
+
delete this.isClickingChart;
|
|
3304
|
+
if (!this.keyboardReset && !this.pointerIsOverChart) {
|
|
3305
|
+
var chart = this.chart,
|
|
3306
|
+
curMod = this.modules &&
|
|
3307
|
+
this.modules[this.currentModuleIx || 0];
|
|
3308
|
+
if (curMod && curMod.terminate) {
|
|
3309
|
+
curMod.terminate();
|
|
3310
|
+
}
|
|
3311
|
+
if (chart.focusElement) {
|
|
3312
|
+
chart.focusElement.removeFocusBorder();
|
|
3313
|
+
}
|
|
3314
|
+
this.currentModuleIx = 0;
|
|
3315
|
+
this.keyboardReset = true;
|
|
3276
3316
|
}
|
|
3277
|
-
}
|
|
3317
|
+
};
|
|
3278
3318
|
/**
|
|
3319
|
+
* Function to run on keydown
|
|
3279
3320
|
* @private
|
|
3321
|
+
* @param {global.KeyboardEvent} ev Browser keydown event.
|
|
3280
3322
|
*/
|
|
3281
|
-
|
|
3282
|
-
var
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
var
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3323
|
+
KeyboardNavigation.prototype.onKeydown = function (ev) {
|
|
3324
|
+
var e = ev || win.event,
|
|
3325
|
+
curNavModule = (this.modules &&
|
|
3326
|
+
this.modules.length &&
|
|
3327
|
+
this.modules[this.currentModuleIx]);
|
|
3328
|
+
var preventDefault;
|
|
3329
|
+
// Used for resetting nav state when clicking outside chart
|
|
3330
|
+
this.keyboardReset = false;
|
|
3331
|
+
// Used for sending focus out of the chart by the modules.
|
|
3332
|
+
this.exiting = false;
|
|
3333
|
+
// If there is a nav module for the current index, run it.
|
|
3334
|
+
// Otherwise, we are outside of the chart in some direction.
|
|
3335
|
+
if (curNavModule) {
|
|
3336
|
+
var response = curNavModule.run(e);
|
|
3337
|
+
if (response === curNavModule.response.success) {
|
|
3338
|
+
preventDefault = true;
|
|
3339
|
+
}
|
|
3340
|
+
else if (response === curNavModule.response.prev) {
|
|
3341
|
+
preventDefault = this.prev();
|
|
3342
|
+
}
|
|
3343
|
+
else if (response === curNavModule.response.next) {
|
|
3344
|
+
preventDefault = this.next();
|
|
3345
|
+
}
|
|
3346
|
+
if (preventDefault) {
|
|
3347
|
+
e.preventDefault();
|
|
3348
|
+
e.stopPropagation();
|
|
3297
3349
|
}
|
|
3298
3350
|
}
|
|
3299
|
-
}
|
|
3351
|
+
};
|
|
3300
3352
|
/**
|
|
3353
|
+
* Go to previous module.
|
|
3301
3354
|
* @private
|
|
3302
3355
|
*/
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
}
|
|
3307
|
-
},
|
|
3356
|
+
KeyboardNavigation.prototype.prev = function () {
|
|
3357
|
+
return this.move(-1);
|
|
3358
|
+
};
|
|
3308
3359
|
/**
|
|
3309
|
-
*
|
|
3310
|
-
* true otherwise.
|
|
3360
|
+
* Go to next module.
|
|
3311
3361
|
* @private
|
|
3312
3362
|
*/
|
|
3313
|
-
|
|
3314
|
-
this.
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3363
|
+
KeyboardNavigation.prototype.next = function () {
|
|
3364
|
+
return this.move(1);
|
|
3365
|
+
};
|
|
3366
|
+
/**
|
|
3367
|
+
* Move to prev/next module.
|
|
3368
|
+
* @private
|
|
3369
|
+
* @param {number} direction
|
|
3370
|
+
* Direction to move. +1 for next, -1 for prev.
|
|
3371
|
+
* @return {boolean}
|
|
3372
|
+
* True if there was a valid module in direction.
|
|
3373
|
+
*/
|
|
3374
|
+
KeyboardNavigation.prototype.move = function (direction) {
|
|
3375
|
+
var curModule = this.modules && this.modules[this.currentModuleIx];
|
|
3376
|
+
if (curModule && curModule.terminate) {
|
|
3377
|
+
curModule.terminate(direction);
|
|
3378
|
+
}
|
|
3379
|
+
// Remove existing focus border if any
|
|
3380
|
+
if (this.chart.focusElement) {
|
|
3381
|
+
this.chart.focusElement.removeFocusBorder();
|
|
3382
|
+
}
|
|
3383
|
+
this.currentModuleIx += direction;
|
|
3384
|
+
var newModule = this.modules && this.modules[this.currentModuleIx];
|
|
3385
|
+
if (newModule) {
|
|
3386
|
+
if (newModule.validate && !newModule.validate()) {
|
|
3387
|
+
return this.move(direction); // Invalid module, recurse
|
|
3388
|
+
}
|
|
3389
|
+
if (newModule.init) {
|
|
3390
|
+
newModule.init(direction); // Valid module, init it
|
|
3391
|
+
return true;
|
|
3392
|
+
}
|
|
3393
|
+
}
|
|
3394
|
+
// No module
|
|
3395
|
+
this.currentModuleIx = 0; // Reset counter
|
|
3396
|
+
// Set focus to chart or exit anchor depending on direction
|
|
3397
|
+
this.exiting = true;
|
|
3398
|
+
if (direction > 0) {
|
|
3399
|
+
this.exitAnchor.focus();
|
|
3400
|
+
}
|
|
3401
|
+
else {
|
|
3402
|
+
this.tabindexContainer.focus();
|
|
3321
3403
|
}
|
|
3322
3404
|
return false;
|
|
3323
|
-
}
|
|
3405
|
+
};
|
|
3324
3406
|
/**
|
|
3407
|
+
* We use an exit anchor to move focus out of chart whenever we want, by
|
|
3408
|
+
* setting focus to this div and not preventing the default tab action. We
|
|
3409
|
+
* also use this when users come back into the chart by tabbing back, in
|
|
3410
|
+
* order to navigate from the end of the chart.
|
|
3325
3411
|
* @private
|
|
3326
3412
|
*/
|
|
3327
|
-
|
|
3328
|
-
this.
|
|
3329
|
-
|
|
3413
|
+
KeyboardNavigation.prototype.updateExitAnchor = function () {
|
|
3414
|
+
var endMarkerId = 'highcharts-end-of-chart-marker-' + this.chart.index,
|
|
3415
|
+
endMarker = getElement(endMarkerId);
|
|
3416
|
+
this.removeExitAnchor();
|
|
3417
|
+
if (endMarker) {
|
|
3418
|
+
this.makeElementAnExitAnchor(endMarker);
|
|
3419
|
+
this.exitAnchor = endMarker;
|
|
3420
|
+
}
|
|
3421
|
+
else {
|
|
3422
|
+
this.createExitAnchor();
|
|
3423
|
+
}
|
|
3424
|
+
};
|
|
3330
3425
|
/**
|
|
3426
|
+
* Chart container should have tabindex if navigation is enabled.
|
|
3331
3427
|
* @private
|
|
3332
3428
|
*/
|
|
3333
|
-
|
|
3334
|
-
var
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
var
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
}
|
|
3347
|
-
|
|
3429
|
+
KeyboardNavigation.prototype.updateContainerTabindex = function () {
|
|
3430
|
+
var a11yOptions = this.chart.options.accessibility,
|
|
3431
|
+
keyboardOptions = a11yOptions && a11yOptions.keyboardNavigation,
|
|
3432
|
+
shouldHaveTabindex = !(keyboardOptions && keyboardOptions.enabled === false),
|
|
3433
|
+
chart = this.chart,
|
|
3434
|
+
container = chart.container;
|
|
3435
|
+
var tabindexContainer;
|
|
3436
|
+
if (chart.renderTo.hasAttribute('tabindex')) {
|
|
3437
|
+
container.removeAttribute('tabindex');
|
|
3438
|
+
tabindexContainer = chart.renderTo;
|
|
3439
|
+
}
|
|
3440
|
+
else {
|
|
3441
|
+
tabindexContainer = container;
|
|
3442
|
+
}
|
|
3443
|
+
this.tabindexContainer = tabindexContainer;
|
|
3444
|
+
var curTabindex = tabindexContainer.getAttribute('tabindex');
|
|
3445
|
+
if (shouldHaveTabindex && !curTabindex) {
|
|
3446
|
+
tabindexContainer.setAttribute('tabindex', '0');
|
|
3447
|
+
}
|
|
3448
|
+
else if (!shouldHaveTabindex) {
|
|
3449
|
+
chart.container.removeAttribute('tabindex');
|
|
3450
|
+
}
|
|
3451
|
+
};
|
|
3348
3452
|
/**
|
|
3349
3453
|
* @private
|
|
3350
3454
|
*/
|
|
3351
|
-
|
|
3352
|
-
var
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
}
|
|
3455
|
+
KeyboardNavigation.prototype.makeElementAnExitAnchor = function (el) {
|
|
3456
|
+
var chartTabindex = this.tabindexContainer.getAttribute('tabindex') || 0;
|
|
3457
|
+
el.setAttribute('class', 'highcharts-exit-anchor');
|
|
3458
|
+
el.setAttribute('tabindex', chartTabindex);
|
|
3459
|
+
el.setAttribute('aria-hidden', false);
|
|
3460
|
+
// Handle focus
|
|
3461
|
+
this.addExitAnchorEventsToEl(el);
|
|
3462
|
+
};
|
|
3359
3463
|
/**
|
|
3464
|
+
* Add new exit anchor to the chart.
|
|
3465
|
+
*
|
|
3360
3466
|
* @private
|
|
3361
3467
|
*/
|
|
3362
|
-
|
|
3363
|
-
var
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
component.proxyLegendItem(item);
|
|
3369
|
-
}
|
|
3370
|
-
});
|
|
3371
|
-
},
|
|
3468
|
+
KeyboardNavigation.prototype.createExitAnchor = function () {
|
|
3469
|
+
var chart = this.chart,
|
|
3470
|
+
exitAnchor = this.exitAnchor = doc.createElement('div');
|
|
3471
|
+
chart.renderTo.appendChild(exitAnchor);
|
|
3472
|
+
this.makeElementAnExitAnchor(exitAnchor);
|
|
3473
|
+
};
|
|
3372
3474
|
/**
|
|
3373
3475
|
* @private
|
|
3374
|
-
* @param {Highcharts.BubbleLegendItem|Point|Highcharts.Series} item
|
|
3375
3476
|
*/
|
|
3376
|
-
|
|
3377
|
-
if (
|
|
3378
|
-
|
|
3477
|
+
KeyboardNavigation.prototype.removeExitAnchor = function () {
|
|
3478
|
+
if (this.exitAnchor && this.exitAnchor.parentNode) {
|
|
3479
|
+
this.exitAnchor.parentNode
|
|
3480
|
+
.removeChild(this.exitAnchor);
|
|
3481
|
+
delete this.exitAnchor;
|
|
3379
3482
|
}
|
|
3380
|
-
|
|
3381
|
-
chart: this.chart,
|
|
3382
|
-
itemName: stripHTMLTags(item.name),
|
|
3383
|
-
item: item
|
|
3384
|
-
});
|
|
3385
|
-
var attribs = {
|
|
3386
|
-
tabindex: -1,
|
|
3387
|
-
'aria-pressed': item.visible,
|
|
3388
|
-
'aria-label': itemLabel
|
|
3389
|
-
};
|
|
3390
|
-
// Considers useHTML
|
|
3391
|
-
var proxyPositioningElement = item.legendGroup.div ? item.legendItem : item.legendGroup;
|
|
3392
|
-
item.a11yProxyElement = this.proxyProvider.addProxyElement('legend', {
|
|
3393
|
-
click: item.legendItem,
|
|
3394
|
-
visual: proxyPositioningElement.element
|
|
3395
|
-
}, attribs);
|
|
3396
|
-
},
|
|
3483
|
+
};
|
|
3397
3484
|
/**
|
|
3398
|
-
*
|
|
3399
|
-
* @return {Highcharts.KeyboardNavigationHandler}
|
|
3485
|
+
* @private
|
|
3400
3486
|
*/
|
|
3401
|
-
|
|
3402
|
-
var
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
return this.response.success;
|
|
3487
|
+
KeyboardNavigation.prototype.addExitAnchorEventsToEl = function (element) {
|
|
3488
|
+
var chart = this.chart,
|
|
3489
|
+
keyboardNavigation = this;
|
|
3490
|
+
this.eventProvider.addEvent(element, 'focus', function (ev) {
|
|
3491
|
+
var e = ev || win.event,
|
|
3492
|
+
focusComesFromChart = (e.relatedTarget &&
|
|
3493
|
+
chart.container.contains(e.relatedTarget)),
|
|
3494
|
+
comingInBackwards = !(focusComesFromChart || keyboardNavigation.exiting);
|
|
3495
|
+
if (comingInBackwards) {
|
|
3496
|
+
// Focus the container instead
|
|
3497
|
+
keyboardNavigation.tabbingInBackwards = true;
|
|
3498
|
+
keyboardNavigation.tabindexContainer.focus();
|
|
3499
|
+
delete keyboardNavigation.tabbingInBackwards;
|
|
3500
|
+
e.preventDefault();
|
|
3501
|
+
// Move to last valid keyboard nav module
|
|
3502
|
+
// Note the we don't run it, just set the index
|
|
3503
|
+
if (keyboardNavigation.modules &&
|
|
3504
|
+
keyboardNavigation.modules.length) {
|
|
3505
|
+
keyboardNavigation.currentModuleIx =
|
|
3506
|
+
keyboardNavigation.modules.length - 1;
|
|
3507
|
+
var curModule = keyboardNavigation.modules[keyboardNavigation.currentModuleIx];
|
|
3508
|
+
// Validate the module
|
|
3509
|
+
if (curModule &&
|
|
3510
|
+
curModule.validate && !curModule.validate()) {
|
|
3511
|
+
// Invalid. Try moving backwards to find next valid.
|
|
3512
|
+
keyboardNavigation.prev();
|
|
3428
3513
|
}
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
component.highlightedLegendItemIx = -1;
|
|
3439
|
-
chart.legend.allItems.forEach(function (item) { return item.setState('', true); });
|
|
3514
|
+
else if (curModule) {
|
|
3515
|
+
// We have a valid module, init it
|
|
3516
|
+
curModule.init(-1);
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
}
|
|
3520
|
+
else {
|
|
3521
|
+
// Don't skip the next focus, we only skip once.
|
|
3522
|
+
keyboardNavigation.exiting = false;
|
|
3440
3523
|
}
|
|
3441
3524
|
});
|
|
3442
|
-
}
|
|
3525
|
+
};
|
|
3443
3526
|
/**
|
|
3527
|
+
* Remove all traces of keyboard navigation.
|
|
3444
3528
|
* @private
|
|
3445
|
-
* @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler
|
|
3446
|
-
* @param {number} keyCode
|
|
3447
|
-
* @return {number}
|
|
3448
|
-
* Response code
|
|
3449
3529
|
*/
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3530
|
+
KeyboardNavigation.prototype.destroy = function () {
|
|
3531
|
+
this.removeExitAnchor();
|
|
3532
|
+
this.eventProvider.removeAddedEvents();
|
|
3533
|
+
this.chart.container.removeAttribute('tabindex');
|
|
3534
|
+
};
|
|
3535
|
+
return KeyboardNavigation;
|
|
3536
|
+
}());
|
|
3537
|
+
/* *
|
|
3538
|
+
*
|
|
3539
|
+
* Class Namespace
|
|
3540
|
+
*
|
|
3541
|
+
* */
|
|
3542
|
+
(function (KeyboardNavigation) {
|
|
3543
|
+
/* *
|
|
3544
|
+
*
|
|
3545
|
+
* Declarations
|
|
3546
|
+
*
|
|
3547
|
+
* */
|
|
3548
|
+
/* *
|
|
3549
|
+
*
|
|
3550
|
+
* Construction
|
|
3551
|
+
*
|
|
3552
|
+
* */
|
|
3553
|
+
var composedItems = [];
|
|
3554
|
+
/* *
|
|
3555
|
+
*
|
|
3556
|
+
* Functions
|
|
3557
|
+
*
|
|
3558
|
+
* */
|
|
3559
|
+
/* eslint-disable valid-jsdoc */
|
|
3470
3560
|
/**
|
|
3471
3561
|
* @private
|
|
3472
|
-
* @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler
|
|
3473
|
-
* @return {number} Response code
|
|
3474
3562
|
*/
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
if (
|
|
3478
|
-
|
|
3563
|
+
function compose(ChartClass) {
|
|
3564
|
+
MenuComponent.compose(ChartClass);
|
|
3565
|
+
if (composedItems.indexOf(ChartClass) === -1) {
|
|
3566
|
+
composedItems.push(ChartClass);
|
|
3567
|
+
var chartProto = ChartClass.prototype;
|
|
3568
|
+
chartProto.dismissPopupContent = chartDismissPopupContent;
|
|
3479
3569
|
}
|
|
3480
|
-
|
|
3481
|
-
|
|
3570
|
+
if (composedItems.indexOf(doc) === -1) {
|
|
3571
|
+
composedItems.push(doc);
|
|
3572
|
+
addEvent(doc, 'keydown', documentOnKeydown);
|
|
3573
|
+
}
|
|
3574
|
+
return ChartClass;
|
|
3575
|
+
}
|
|
3576
|
+
KeyboardNavigation.compose = compose;
|
|
3482
3577
|
/**
|
|
3578
|
+
* Dismiss popup content in chart, including export menu and tooltip.
|
|
3483
3579
|
* @private
|
|
3484
|
-
* @return {boolean|undefined}
|
|
3485
3580
|
*/
|
|
3486
|
-
|
|
3487
|
-
var chart = this
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
legendA11yOptions.enabled &&
|
|
3496
|
-
legendA11yOptions.keyboardNavigation &&
|
|
3497
|
-
legendA11yOptions.keyboardNavigation.enabled);
|
|
3498
|
-
},
|
|
3581
|
+
function chartDismissPopupContent() {
|
|
3582
|
+
var chart = this;
|
|
3583
|
+
fireEvent(this, 'dismissPopupContent', {}, function () {
|
|
3584
|
+
if (chart.tooltip) {
|
|
3585
|
+
chart.tooltip.hide(0);
|
|
3586
|
+
}
|
|
3587
|
+
chart.hideExportMenu();
|
|
3588
|
+
});
|
|
3589
|
+
}
|
|
3499
3590
|
/**
|
|
3591
|
+
* Add event listener to document to detect ESC key press and dismiss
|
|
3592
|
+
* hover/popup content.
|
|
3500
3593
|
* @private
|
|
3501
|
-
* @param {number} direction
|
|
3502
3594
|
*/
|
|
3503
|
-
|
|
3504
|
-
var
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3595
|
+
function documentOnKeydown(e) {
|
|
3596
|
+
var keycode = e.which || e.keyCode;
|
|
3597
|
+
var esc = 27;
|
|
3598
|
+
if (keycode === esc && H.charts) {
|
|
3599
|
+
H.charts.forEach(function (chart) {
|
|
3600
|
+
if (chart && chart.dismissPopupContent) {
|
|
3601
|
+
chart.dismissPopupContent();
|
|
3602
|
+
}
|
|
3603
|
+
});
|
|
3604
|
+
}
|
|
3509
3605
|
}
|
|
3510
|
-
});
|
|
3606
|
+
})(KeyboardNavigation || (KeyboardNavigation = {}));
|
|
3607
|
+
/* *
|
|
3608
|
+
*
|
|
3609
|
+
* Default Export
|
|
3610
|
+
*
|
|
3611
|
+
* */
|
|
3511
3612
|
|
|
3512
|
-
return
|
|
3613
|
+
return KeyboardNavigation;
|
|
3513
3614
|
});
|
|
3514
|
-
_registerModule(_modules, 'Accessibility/Components/
|
|
3615
|
+
_registerModule(_modules, 'Accessibility/Components/LegendComponent.js', [_modules['Core/Animation/AnimationUtilities.js'], _modules['Core/Chart/Chart.js'], _modules['Core/Globals.js'], _modules['Core/Legend/Legend.js'], _modules['Core/Utilities.js'], _modules['Accessibility/AccessibilityComponent.js'], _modules['Accessibility/KeyboardNavigationHandler.js'], _modules['Accessibility/Utils/HTMLUtilities.js'], _modules['Accessibility/Utils/ChartUtilities.js']], function (A, Chart, H, Legend, U, AccessibilityComponent, KeyboardNavigationHandler, HTMLUtilities, ChartUtils) {
|
|
3515
3616
|
/* *
|
|
3516
3617
|
*
|
|
3517
3618
|
* (c) 2009-2021 Øystein Moseng
|
|
3518
3619
|
*
|
|
3519
|
-
* Accessibility component for
|
|
3620
|
+
* Accessibility component for chart legend.
|
|
3520
3621
|
*
|
|
3521
3622
|
* License: www.highcharts.com/license
|
|
3522
3623
|
*
|
|
3523
3624
|
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
3524
3625
|
*
|
|
3525
3626
|
* */
|
|
3526
|
-
var
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3627
|
+
var animObject = A.animObject;
|
|
3628
|
+
var addEvent = U.addEvent,
|
|
3629
|
+
extend = U.extend,
|
|
3630
|
+
fireEvent = U.fireEvent,
|
|
3631
|
+
isNumber = U.isNumber,
|
|
3632
|
+
pick = U.pick,
|
|
3633
|
+
syncTimeout = U.syncTimeout;
|
|
3634
|
+
var stripHTMLTags = HTMLUtilities.stripHTMLTagsFromString,
|
|
3635
|
+
addClass = HTMLUtilities.addClass,
|
|
3636
|
+
removeClass = HTMLUtilities.removeClass;
|
|
3637
|
+
var getChartTitle = ChartUtils.getChartTitle;
|
|
3531
3638
|
/* eslint-disable no-invalid-this, valid-jsdoc */
|
|
3532
3639
|
/**
|
|
3533
|
-
* Get the wrapped export button element of a chart.
|
|
3534
|
-
*
|
|
3535
|
-
* @private
|
|
3536
|
-
* @param {Highcharts.Chart} chart
|
|
3537
|
-
* @returns {Highcharts.SVGElement}
|
|
3538
|
-
*/
|
|
3539
|
-
function getExportMenuButtonElement(chart) {
|
|
3540
|
-
return chart.exportSVGElements && chart.exportSVGElements[0];
|
|
3541
|
-
}
|
|
3542
|
-
/**
|
|
3543
|
-
* Show the export menu and focus the first item (if exists).
|
|
3544
|
-
*
|
|
3545
3640
|
* @private
|
|
3546
|
-
* @function Highcharts.Chart#showExportMenu
|
|
3547
3641
|
*/
|
|
3548
|
-
|
|
3549
|
-
var
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
el.onclick(getFakeMouseEvent('click'));
|
|
3554
|
-
}
|
|
3642
|
+
function scrollLegendToItem(legend, itemIx) {
|
|
3643
|
+
var itemPage = legend.allItems[itemIx].pageIx,
|
|
3644
|
+
curPage = legend.currentPage;
|
|
3645
|
+
if (typeof itemPage !== 'undefined' && itemPage + 1 !== curPage) {
|
|
3646
|
+
legend.scroll(1 + itemPage - curPage);
|
|
3555
3647
|
}
|
|
3556
|
-
}
|
|
3648
|
+
}
|
|
3557
3649
|
/**
|
|
3558
3650
|
* @private
|
|
3559
|
-
* @function Highcharts.Chart#hideExportMenu
|
|
3560
3651
|
*/
|
|
3561
|
-
|
|
3562
|
-
var
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
el.className === 'highcharts-menu-item' &&
|
|
3569
|
-
el.onmouseout) {
|
|
3570
|
-
el.onmouseout(getFakeMouseEvent('mouseout'));
|
|
3571
|
-
}
|
|
3572
|
-
});
|
|
3573
|
-
chart.highlightedExportItemIx = 0;
|
|
3574
|
-
// Hide the menu div
|
|
3575
|
-
chart.exportContextMenu.hideMenu();
|
|
3576
|
-
// Make sure the chart has focus and can capture keyboard events
|
|
3577
|
-
chart.container.focus();
|
|
3578
|
-
}
|
|
3579
|
-
};
|
|
3652
|
+
function shouldDoLegendA11y(chart) {
|
|
3653
|
+
var items = chart.legend && chart.legend.allItems,
|
|
3654
|
+
legendA11yOptions = (chart.options.legend.accessibility || {});
|
|
3655
|
+
return !!(items && items.length &&
|
|
3656
|
+
!(chart.colorAxis && chart.colorAxis.length) &&
|
|
3657
|
+
legendA11yOptions.enabled !== false);
|
|
3658
|
+
}
|
|
3580
3659
|
/**
|
|
3581
|
-
* Highlight
|
|
3660
|
+
* Highlight legend item by index.
|
|
3582
3661
|
*
|
|
3583
3662
|
* @private
|
|
3584
|
-
* @function Highcharts.Chart#
|
|
3663
|
+
* @function Highcharts.Chart#highlightLegendItem
|
|
3585
3664
|
*
|
|
3586
3665
|
* @param {number} ix
|
|
3587
3666
|
*
|
|
3588
3667
|
* @return {boolean}
|
|
3589
3668
|
*/
|
|
3590
|
-
Chart.prototype.
|
|
3591
|
-
var
|
|
3592
|
-
var
|
|
3593
|
-
this.
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
listItem.onmouseover(getFakeMouseEvent('mouseover'));
|
|
3609
|
-
}
|
|
3610
|
-
this.highlightedExportItemIx = ix;
|
|
3669
|
+
Chart.prototype.highlightLegendItem = function (ix) {
|
|
3670
|
+
var items = this.legend.allItems;
|
|
3671
|
+
var oldIx = this.accessibility &&
|
|
3672
|
+
this.accessibility.components.legend.highlightedLegendItemIx;
|
|
3673
|
+
var itemToHighlight = items[ix];
|
|
3674
|
+
if (itemToHighlight) {
|
|
3675
|
+
if (isNumber(oldIx) && items[oldIx]) {
|
|
3676
|
+
fireEvent(items[oldIx].legendGroup.element, 'mouseout');
|
|
3677
|
+
}
|
|
3678
|
+
scrollLegendToItem(this.legend, ix);
|
|
3679
|
+
var legendItemProp = itemToHighlight.legendItem;
|
|
3680
|
+
var proxyBtn = itemToHighlight.a11yProxyElement && itemToHighlight.a11yProxyElement.buttonElement;
|
|
3681
|
+
if (legendItemProp && legendItemProp.element && proxyBtn) {
|
|
3682
|
+
this.setFocusToElement(legendItemProp, proxyBtn);
|
|
3683
|
+
}
|
|
3684
|
+
if (itemToHighlight.legendGroup) {
|
|
3685
|
+
fireEvent(itemToHighlight.legendGroup.element, 'mouseover');
|
|
3686
|
+
}
|
|
3611
3687
|
return true;
|
|
3612
3688
|
}
|
|
3613
3689
|
return false;
|
|
3614
3690
|
};
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
Chart.prototype.highlightLastExportItem = function () {
|
|
3623
|
-
var chart = this;
|
|
3624
|
-
if (chart.exportDivElements) {
|
|
3625
|
-
var i = chart.exportDivElements.length;
|
|
3626
|
-
while (i--) {
|
|
3627
|
-
if (chart.highlightExportItem(i)) {
|
|
3628
|
-
return true;
|
|
3629
|
-
}
|
|
3630
|
-
}
|
|
3691
|
+
// Keep track of pressed state for legend items
|
|
3692
|
+
addEvent(Legend, 'afterColorizeItem', function (e) {
|
|
3693
|
+
var chart = this.chart,
|
|
3694
|
+
a11yOptions = chart.options.accessibility,
|
|
3695
|
+
legendItem = e.item;
|
|
3696
|
+
if (a11yOptions.enabled && legendItem && legendItem.a11yProxyElement) {
|
|
3697
|
+
legendItem.a11yProxyElement.buttonElement.setAttribute('aria-pressed', e.visible ? 'true' : 'false');
|
|
3631
3698
|
}
|
|
3632
|
-
|
|
3633
|
-
};
|
|
3634
|
-
/**
|
|
3635
|
-
* @private
|
|
3636
|
-
* @param {Highcharts.Chart} chart
|
|
3637
|
-
*/
|
|
3638
|
-
function exportingShouldHaveA11y(chart) {
|
|
3639
|
-
var exportingOpts = chart.options.exporting,
|
|
3640
|
-
exportButton = getExportMenuButtonElement(chart);
|
|
3641
|
-
return !!(exportingOpts &&
|
|
3642
|
-
exportingOpts.enabled !== false &&
|
|
3643
|
-
exportingOpts.accessibility &&
|
|
3644
|
-
exportingOpts.accessibility.enabled &&
|
|
3645
|
-
exportButton &&
|
|
3646
|
-
exportButton.element);
|
|
3647
|
-
}
|
|
3699
|
+
});
|
|
3648
3700
|
/**
|
|
3649
|
-
* The
|
|
3701
|
+
* The LegendComponent class
|
|
3650
3702
|
*
|
|
3651
3703
|
* @private
|
|
3652
3704
|
* @class
|
|
3653
|
-
* @name Highcharts.
|
|
3705
|
+
* @name Highcharts.LegendComponent
|
|
3654
3706
|
*/
|
|
3655
|
-
var
|
|
3656
|
-
|
|
3657
|
-
extend(
|
|
3707
|
+
var LegendComponent = function () { };
|
|
3708
|
+
LegendComponent.prototype = new AccessibilityComponent();
|
|
3709
|
+
extend(LegendComponent.prototype, /** @lends Highcharts.LegendComponent */ {
|
|
3658
3710
|
/**
|
|
3659
3711
|
* Init the component
|
|
3712
|
+
* @private
|
|
3660
3713
|
*/
|
|
3661
3714
|
init: function () {
|
|
3662
|
-
var
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3715
|
+
var component = this;
|
|
3716
|
+
this.recreateProxies();
|
|
3717
|
+
// Note: Chart could create legend dynamically, so events can not be
|
|
3718
|
+
// tied to the component's chart's current legend.
|
|
3719
|
+
this.addEvent(Legend, 'afterScroll', function () {
|
|
3720
|
+
if (this.chart === component.chart) {
|
|
3721
|
+
component.proxyProvider.updateGroupProxyElementPositions('legend');
|
|
3722
|
+
component.updateLegendItemProxyVisibility();
|
|
3723
|
+
if (component.highlightedLegendItemIx > -1) {
|
|
3724
|
+
this.chart.highlightLegendItem(component.highlightedLegendItemIx);
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3666
3727
|
});
|
|
3667
|
-
this.addEvent(
|
|
3668
|
-
component.
|
|
3728
|
+
this.addEvent(Legend, 'afterPositionItem', function (e) {
|
|
3729
|
+
if (this.chart === component.chart && this.chart.renderer) {
|
|
3730
|
+
component.updateProxyPositionForItem(e.item);
|
|
3731
|
+
}
|
|
3732
|
+
});
|
|
3733
|
+
this.addEvent(Legend, 'afterRender', function () {
|
|
3734
|
+
if (this.chart === component.chart &&
|
|
3735
|
+
this.chart.renderer &&
|
|
3736
|
+
component.recreateProxies()) {
|
|
3737
|
+
syncTimeout(function () { return component.proxyProvider.updateGroupProxyElementPositions('legend'); }, animObject(pick(this.chart.renderer.globalAnimation, true)).duration);
|
|
3738
|
+
}
|
|
3669
3739
|
});
|
|
3670
|
-
this.createProxyGroup();
|
|
3671
3740
|
},
|
|
3672
3741
|
/**
|
|
3742
|
+
* Update visibility of legend items when using paged legend
|
|
3673
3743
|
* @private
|
|
3674
3744
|
*/
|
|
3675
|
-
|
|
3676
|
-
var
|
|
3677
|
-
|
|
3678
|
-
|
|
3745
|
+
updateLegendItemProxyVisibility: function () {
|
|
3746
|
+
var chart = this.chart;
|
|
3747
|
+
var legend = chart.legend;
|
|
3748
|
+
var items = legend.allItems || [];
|
|
3749
|
+
var curPage = legend.currentPage || 1;
|
|
3750
|
+
var clipHeight = legend.clipHeight || 0;
|
|
3751
|
+
items.forEach(function (item) {
|
|
3752
|
+
if (item.a11yProxyElement) {
|
|
3753
|
+
var hasPages = legend.pages && legend.pages.length;
|
|
3754
|
+
var proxyEl = item.a11yProxyElement.element;
|
|
3755
|
+
var hide = false;
|
|
3756
|
+
if (hasPages) {
|
|
3757
|
+
var itemPage = item.pageIx || 0;
|
|
3758
|
+
var y = item._legendItemPos ? item._legendItemPos[1] : 0;
|
|
3759
|
+
var h = item.legendItem ? Math.round(item.legendItem.getBBox().height) : 0;
|
|
3760
|
+
hide = y + h - legend.pages[itemPage] > clipHeight || itemPage !== curPage - 1;
|
|
3761
|
+
}
|
|
3762
|
+
if (hide) {
|
|
3763
|
+
if (chart.styledMode) {
|
|
3764
|
+
addClass(proxyEl, 'highcharts-a11y-invisible');
|
|
3765
|
+
}
|
|
3766
|
+
else {
|
|
3767
|
+
proxyEl.style.visibility = 'hidden';
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3770
|
+
else {
|
|
3771
|
+
removeClass(proxyEl, 'highcharts-a11y-invisible');
|
|
3772
|
+
proxyEl.style.visibility = '';
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
});
|
|
3776
|
+
},
|
|
3777
|
+
/**
|
|
3778
|
+
* @private
|
|
3779
|
+
*/
|
|
3780
|
+
onChartRender: function () {
|
|
3781
|
+
if (!shouldDoLegendA11y(this.chart)) {
|
|
3782
|
+
this.removeProxies();
|
|
3679
3783
|
}
|
|
3680
|
-
this.isExportMenuShown = false;
|
|
3681
|
-
this.setExportButtonExpandedState('false');
|
|
3682
3784
|
},
|
|
3683
3785
|
/**
|
|
3684
3786
|
* @private
|
|
3685
3787
|
*/
|
|
3686
|
-
|
|
3687
|
-
var chart = this.chart
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3788
|
+
highlightAdjacentLegendPage: function (direction) {
|
|
3789
|
+
var chart = this.chart;
|
|
3790
|
+
var legend = chart.legend;
|
|
3791
|
+
var curPageIx = legend.currentPage || 1;
|
|
3792
|
+
var newPageIx = curPageIx + direction;
|
|
3793
|
+
var pages = legend.pages || [];
|
|
3794
|
+
if (newPageIx > 0 && newPageIx <= pages.length) {
|
|
3795
|
+
var len = legend.allItems.length;
|
|
3796
|
+
for (var i = 0; i < len; ++i) {
|
|
3797
|
+
if (legend.allItems[i].pageIx + 1 === newPageIx) {
|
|
3798
|
+
var res = chart.highlightLegendItem(i);
|
|
3799
|
+
if (res) {
|
|
3800
|
+
this.highlightedLegendItemIx = i;
|
|
3801
|
+
}
|
|
3802
|
+
return;
|
|
3803
|
+
}
|
|
3804
|
+
}
|
|
3692
3805
|
}
|
|
3693
|
-
this.isExportMenuShown = true;
|
|
3694
|
-
this.setExportButtonExpandedState('true');
|
|
3695
3806
|
},
|
|
3696
3807
|
/**
|
|
3697
3808
|
* @private
|
|
3698
|
-
* @param {string} stateStr
|
|
3699
3809
|
*/
|
|
3700
|
-
|
|
3701
|
-
if (
|
|
3702
|
-
|
|
3810
|
+
updateProxyPositionForItem: function (item) {
|
|
3811
|
+
if (item.a11yProxyElement) {
|
|
3812
|
+
item.a11yProxyElement.refreshPosition();
|
|
3703
3813
|
}
|
|
3704
3814
|
},
|
|
3705
3815
|
/**
|
|
3706
|
-
*
|
|
3707
|
-
*
|
|
3816
|
+
* Returns false if legend a11y is disabled and proxies were not created,
|
|
3817
|
+
* true otherwise.
|
|
3818
|
+
* @private
|
|
3708
3819
|
*/
|
|
3709
|
-
|
|
3710
|
-
this.
|
|
3711
|
-
this.
|
|
3820
|
+
recreateProxies: function () {
|
|
3821
|
+
this.removeProxies();
|
|
3822
|
+
if (shouldDoLegendA11y(this.chart)) {
|
|
3823
|
+
this.addLegendProxyGroup();
|
|
3824
|
+
this.proxyLegendItems();
|
|
3825
|
+
this.updateLegendItemProxyVisibility();
|
|
3826
|
+
this.updateLegendTitle();
|
|
3827
|
+
return true;
|
|
3828
|
+
}
|
|
3829
|
+
return false;
|
|
3712
3830
|
},
|
|
3713
3831
|
/**
|
|
3714
3832
|
* @private
|
|
3715
3833
|
*/
|
|
3716
|
-
|
|
3834
|
+
removeProxies: function () {
|
|
3835
|
+
this.proxyProvider.removeGroup('legend');
|
|
3836
|
+
},
|
|
3837
|
+
/**
|
|
3838
|
+
* @private
|
|
3839
|
+
*/
|
|
3840
|
+
updateLegendTitle: function () {
|
|
3717
3841
|
var chart = this.chart;
|
|
3718
|
-
var
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
'aria-expanded': false
|
|
3842
|
+
var legendTitle = stripHTMLTags((chart.legend &&
|
|
3843
|
+
chart.legend.options.title &&
|
|
3844
|
+
chart.legend.options.title.text ||
|
|
3845
|
+
'').replace(/<br ?\/?>/g, ' '));
|
|
3846
|
+
var legendLabel = chart.langFormat('accessibility.legend.legendLabel' + (legendTitle ? '' : 'NoTitle'), {
|
|
3847
|
+
chart: chart,
|
|
3848
|
+
legendTitle: legendTitle,
|
|
3849
|
+
chartTitle: getChartTitle(chart)
|
|
3727
3850
|
});
|
|
3728
|
-
|
|
3851
|
+
this.proxyProvider.updateGroupAttrs('legend', {
|
|
3852
|
+
'aria-label': legendLabel
|
|
3853
|
+
});
|
|
3729
3854
|
},
|
|
3730
3855
|
/**
|
|
3731
3856
|
* @private
|
|
3732
3857
|
*/
|
|
3733
|
-
|
|
3734
|
-
var
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3858
|
+
addLegendProxyGroup: function () {
|
|
3859
|
+
var a11yOptions = this.chart.options.accessibility;
|
|
3860
|
+
var groupRole = a11yOptions.landmarkVerbosity === 'all' ? 'region' : null;
|
|
3861
|
+
this.proxyProvider.addGroup('legend', 'ul', {
|
|
3862
|
+
'aria-label': '_placeholder_',
|
|
3863
|
+
role: groupRole
|
|
3864
|
+
});
|
|
3738
3865
|
},
|
|
3739
3866
|
/**
|
|
3740
3867
|
* @private
|
|
3741
3868
|
*/
|
|
3742
|
-
|
|
3743
|
-
var
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
if (item) {
|
|
3750
|
-
if (item.tagName === 'LI' &&
|
|
3751
|
-
!(item.children && item.children.length)) {
|
|
3752
|
-
item.setAttribute('tabindex', -1);
|
|
3753
|
-
}
|
|
3754
|
-
else {
|
|
3755
|
-
item.setAttribute('aria-hidden', 'true');
|
|
3756
|
-
}
|
|
3757
|
-
}
|
|
3758
|
-
});
|
|
3759
|
-
// Set accessibility properties on parent div
|
|
3760
|
-
var parentDiv = (exportList[0] && exportList[0].parentNode);
|
|
3761
|
-
if (parentDiv) {
|
|
3762
|
-
attr(parentDiv, {
|
|
3763
|
-
'aria-hidden': void 0,
|
|
3764
|
-
'aria-label': chart.langFormat('accessibility.exporting.chartMenuLabel', { chart: chart }),
|
|
3765
|
-
role: 'list' // Needed for webkit/VO
|
|
3766
|
-
});
|
|
3869
|
+
proxyLegendItems: function () {
|
|
3870
|
+
var component = this,
|
|
3871
|
+
items = (this.chart.legend &&
|
|
3872
|
+
this.chart.legend.allItems || []);
|
|
3873
|
+
items.forEach(function (item) {
|
|
3874
|
+
if (item.legendItem && item.legendItem.element) {
|
|
3875
|
+
component.proxyLegendItem(item);
|
|
3767
3876
|
}
|
|
3877
|
+
});
|
|
3878
|
+
},
|
|
3879
|
+
/**
|
|
3880
|
+
* @private
|
|
3881
|
+
* @param {Highcharts.BubbleLegendItem|Point|Highcharts.Series} item
|
|
3882
|
+
*/
|
|
3883
|
+
proxyLegendItem: function (item) {
|
|
3884
|
+
if (!item.legendItem || !item.legendGroup) {
|
|
3885
|
+
return;
|
|
3768
3886
|
}
|
|
3887
|
+
var itemLabel = this.chart.langFormat('accessibility.legend.legendItem', {
|
|
3888
|
+
chart: this.chart,
|
|
3889
|
+
itemName: stripHTMLTags(item.name),
|
|
3890
|
+
item: item
|
|
3891
|
+
});
|
|
3892
|
+
var attribs = {
|
|
3893
|
+
tabindex: -1,
|
|
3894
|
+
'aria-pressed': item.visible,
|
|
3895
|
+
'aria-label': itemLabel
|
|
3896
|
+
};
|
|
3897
|
+
// Considers useHTML
|
|
3898
|
+
var proxyPositioningElement = item.legendGroup.div ? item.legendItem : item.legendGroup;
|
|
3899
|
+
item.a11yProxyElement = this.proxyProvider.addProxyElement('legend', {
|
|
3900
|
+
click: item.legendItem,
|
|
3901
|
+
visual: proxyPositioningElement.element
|
|
3902
|
+
}, attribs);
|
|
3769
3903
|
},
|
|
3770
3904
|
/**
|
|
3771
3905
|
* Get keyboard navigation handler for this component.
|
|
@@ -3773,122 +3907,116 @@
|
|
|
3773
3907
|
*/
|
|
3774
3908
|
getKeyboardNavigation: function () {
|
|
3775
3909
|
var keys = this.keyCodes,
|
|
3776
|
-
|
|
3777
|
-
|
|
3910
|
+
component = this,
|
|
3911
|
+
chart = this.chart;
|
|
3778
3912
|
return new KeyboardNavigationHandler(chart, {
|
|
3779
3913
|
keyCodeMap: [
|
|
3780
|
-
// Arrow prev handler
|
|
3781
3914
|
[
|
|
3782
|
-
[keys.left, keys.up],
|
|
3783
|
-
function () {
|
|
3784
|
-
return component.
|
|
3915
|
+
[keys.left, keys.right, keys.up, keys.down],
|
|
3916
|
+
function (keyCode) {
|
|
3917
|
+
return component.onKbdArrowKey(this, keyCode);
|
|
3785
3918
|
}
|
|
3786
3919
|
],
|
|
3787
|
-
// Arrow next handler
|
|
3788
3920
|
[
|
|
3789
|
-
[keys.
|
|
3790
|
-
function () {
|
|
3791
|
-
|
|
3921
|
+
[keys.enter, keys.space],
|
|
3922
|
+
function (keyCode) {
|
|
3923
|
+
if (H.isFirefox && keyCode === keys.space) { // #15520
|
|
3924
|
+
return this.response.success;
|
|
3925
|
+
}
|
|
3926
|
+
return component.onKbdClick(this);
|
|
3792
3927
|
}
|
|
3793
3928
|
],
|
|
3794
|
-
// Click handler
|
|
3795
3929
|
[
|
|
3796
|
-
[keys.
|
|
3797
|
-
function () {
|
|
3798
|
-
|
|
3930
|
+
[keys.pageDown, keys.pageUp],
|
|
3931
|
+
function (keyCode) {
|
|
3932
|
+
var direction = keyCode === keys.pageDown ? 1 : -1;
|
|
3933
|
+
component.highlightAdjacentLegendPage(direction);
|
|
3934
|
+
return this.response.success;
|
|
3799
3935
|
}
|
|
3800
3936
|
]
|
|
3801
|
-
],
|
|
3802
|
-
// Only run exporting navigation if exporting support exists and is
|
|
3803
|
-
// enabled on chart
|
|
3937
|
+
],
|
|
3804
3938
|
validate: function () {
|
|
3805
|
-
return
|
|
3806
|
-
chart.options.exporting.enabled !== false &&
|
|
3807
|
-
chart.options.exporting.accessibility.enabled !==
|
|
3808
|
-
false;
|
|
3939
|
+
return component.shouldHaveLegendNavigation();
|
|
3809
3940
|
},
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
var proxy = component.exportButtonProxy;
|
|
3813
|
-
var svgEl = component.chart.exportingGroup;
|
|
3814
|
-
if (proxy && svgEl) {
|
|
3815
|
-
chart.setFocusToElement(svgEl, proxy.buttonElement);
|
|
3816
|
-
}
|
|
3941
|
+
init: function (direction) {
|
|
3942
|
+
return component.onKbdNavigationInit(direction);
|
|
3817
3943
|
},
|
|
3818
|
-
// Hide the menu
|
|
3819
3944
|
terminate: function () {
|
|
3820
|
-
|
|
3945
|
+
component.highlightedLegendItemIx = -1;
|
|
3946
|
+
chart.legend.allItems.forEach(function (item) { return item.setState('', true); });
|
|
3821
3947
|
}
|
|
3822
3948
|
});
|
|
3823
3949
|
},
|
|
3824
3950
|
/**
|
|
3825
3951
|
* @private
|
|
3826
3952
|
* @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler
|
|
3827
|
-
* @
|
|
3953
|
+
* @param {number} keyCode
|
|
3954
|
+
* @return {number}
|
|
3955
|
+
* Response code
|
|
3828
3956
|
*/
|
|
3829
|
-
|
|
3830
|
-
var
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3957
|
+
onKbdArrowKey: function (keyboardNavigationHandler, keyCode) {
|
|
3958
|
+
var keys = this.keyCodes,
|
|
3959
|
+
response = keyboardNavigationHandler.response,
|
|
3960
|
+
chart = this.chart,
|
|
3961
|
+
a11yOptions = chart.options.accessibility,
|
|
3962
|
+
numItems = chart.legend.allItems.length,
|
|
3963
|
+
direction = (keyCode === keys.left || keyCode === keys.up) ? -1 : 1;
|
|
3964
|
+
var res = chart.highlightLegendItem(this.highlightedLegendItemIx + direction);
|
|
3965
|
+
if (res) {
|
|
3966
|
+
this.highlightedLegendItemIx += direction;
|
|
3967
|
+
return response.success;
|
|
3840
3968
|
}
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3969
|
+
if (numItems > 1 &&
|
|
3970
|
+
a11yOptions.keyboardNavigation.wrapAround) {
|
|
3971
|
+
keyboardNavigationHandler.init(direction);
|
|
3844
3972
|
return response.success;
|
|
3845
3973
|
}
|
|
3846
|
-
|
|
3974
|
+
// No wrap, move
|
|
3975
|
+
return response[direction > 0 ? 'next' : 'prev'];
|
|
3847
3976
|
},
|
|
3848
3977
|
/**
|
|
3849
3978
|
* @private
|
|
3850
3979
|
* @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler
|
|
3851
3980
|
* @return {number} Response code
|
|
3852
3981
|
*/
|
|
3853
|
-
|
|
3854
|
-
var
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
// Try to highlight next item in list. Highlighting e.g.
|
|
3858
|
-
// separators will fail.
|
|
3859
|
-
for (var i = (chart.highlightedExportItemIx || 0) + 1; i < chart.exportDivElements.length; ++i) {
|
|
3860
|
-
if (chart.highlightExportItem(i)) {
|
|
3861
|
-
return response.success;
|
|
3862
|
-
}
|
|
3863
|
-
}
|
|
3864
|
-
// We failed, so wrap around or move to next module
|
|
3865
|
-
if (a11yOptions.keyboardNavigation.wrapAround) {
|
|
3866
|
-
chart.highlightExportItem(0);
|
|
3867
|
-
return response.success;
|
|
3982
|
+
onKbdClick: function (keyboardNavigationHandler) {
|
|
3983
|
+
var legendItem = this.chart.legend.allItems[this.highlightedLegendItemIx];
|
|
3984
|
+
if (legendItem && legendItem.a11yProxyElement) {
|
|
3985
|
+
legendItem.a11yProxyElement.click();
|
|
3868
3986
|
}
|
|
3869
|
-
return response.
|
|
3987
|
+
return keyboardNavigationHandler.response.success;
|
|
3870
3988
|
},
|
|
3871
3989
|
/**
|
|
3872
3990
|
* @private
|
|
3873
|
-
* @
|
|
3874
|
-
* @return {number} Response code
|
|
3991
|
+
* @return {boolean|undefined}
|
|
3875
3992
|
*/
|
|
3876
|
-
|
|
3877
|
-
var chart = this.chart
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3993
|
+
shouldHaveLegendNavigation: function () {
|
|
3994
|
+
var chart = this.chart,
|
|
3995
|
+
legendOptions = chart.options.legend || {},
|
|
3996
|
+
hasLegend = chart.legend && chart.legend.allItems,
|
|
3997
|
+
hasColorAxis = chart.colorAxis && chart.colorAxis.length,
|
|
3998
|
+
legendA11yOptions = (legendOptions.accessibility || {});
|
|
3999
|
+
return !!(hasLegend &&
|
|
4000
|
+
chart.legend.display &&
|
|
4001
|
+
!hasColorAxis &&
|
|
4002
|
+
legendA11yOptions.enabled &&
|
|
4003
|
+
legendA11yOptions.keyboardNavigation &&
|
|
4004
|
+
legendA11yOptions.keyboardNavigation.enabled);
|
|
4005
|
+
},
|
|
4006
|
+
/**
|
|
4007
|
+
* @private
|
|
4008
|
+
* @param {number} direction
|
|
4009
|
+
*/
|
|
4010
|
+
onKbdNavigationInit: function (direction) {
|
|
4011
|
+
var chart = this.chart,
|
|
4012
|
+
lastIx = chart.legend.allItems.length - 1,
|
|
4013
|
+
ixToHighlight = direction > 0 ? 0 : lastIx;
|
|
4014
|
+
chart.highlightLegendItem(ixToHighlight);
|
|
4015
|
+
this.highlightedLegendItemIx = ixToHighlight;
|
|
3888
4016
|
}
|
|
3889
4017
|
});
|
|
3890
4018
|
|
|
3891
|
-
return
|
|
4019
|
+
return LegendComponent;
|
|
3892
4020
|
});
|
|
3893
4021
|
_registerModule(_modules, 'Accessibility/Components/SeriesComponent/SeriesDescriber.js', [_modules['Accessibility/Components/AnnotationsA11y.js'], _modules['Accessibility/Utils/ChartUtilities.js'], _modules['Core/FormatUtilities.js'], _modules['Accessibility/Utils/HTMLUtilities.js'], _modules['Core/Utilities.js']], function (AnnotationsA11y, ChartUtilities, F, HTMLUtilities, U) {
|
|
3894
4022
|
/* *
|
|
@@ -7609,7 +7737,7 @@
|
|
|
7609
7737
|
|
|
7610
7738
|
return RangeSelector;
|
|
7611
7739
|
});
|
|
7612
|
-
_registerModule(_modules, 'Accessibility/Components/RangeSelectorComponent.js', [_modules['Extensions/RangeSelector.js'], _modules['Accessibility/AccessibilityComponent.js'], _modules['Accessibility/Utils/ChartUtilities.js'], _modules['Accessibility/Utils/Announcer.js'], _modules['
|
|
7740
|
+
_registerModule(_modules, 'Accessibility/Components/RangeSelectorComponent.js', [_modules['Extensions/RangeSelector.js'], _modules['Accessibility/AccessibilityComponent.js'], _modules['Accessibility/Utils/ChartUtilities.js'], _modules['Accessibility/Utils/Announcer.js'], _modules['Accessibility/KeyboardNavigationHandler.js'], _modules['Core/Utilities.js']], function (RangeSelector, AccessibilityComponent, ChartUtilities, Announcer, KeyboardNavigationHandler, U) {
|
|
7613
7741
|
/* *
|
|
7614
7742
|
*
|
|
7615
7743
|
* (c) 2009-2021 Øystein Moseng
|
|
@@ -7621,12 +7749,32 @@
|
|
|
7621
7749
|
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
7622
7750
|
*
|
|
7623
7751
|
* */
|
|
7752
|
+
var __extends = (this && this.__extends) || (function () {
|
|
7753
|
+
var extendStatics = function (d,
|
|
7754
|
+
b) {
|
|
7755
|
+
extendStatics = Object.setPrototypeOf ||
|
|
7756
|
+
({ __proto__: [] } instanceof Array && function (d,
|
|
7757
|
+
b) { d.__proto__ = b; }) ||
|
|
7758
|
+
function (d,
|
|
7759
|
+
b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7760
|
+
return extendStatics(d, b);
|
|
7761
|
+
};
|
|
7762
|
+
return function (d, b) {
|
|
7763
|
+
extendStatics(d, b);
|
|
7764
|
+
function __() { this.constructor = d; }
|
|
7765
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
7766
|
+
};
|
|
7767
|
+
})();
|
|
7624
7768
|
var unhideChartElementFromAT = ChartUtilities.unhideChartElementFromAT,
|
|
7625
7769
|
getAxisRangeDescription = ChartUtilities.getAxisRangeDescription;
|
|
7626
7770
|
var addEvent = U.addEvent,
|
|
7627
|
-
attr = U.attr
|
|
7628
|
-
|
|
7629
|
-
|
|
7771
|
+
attr = U.attr;
|
|
7772
|
+
/* *
|
|
7773
|
+
*
|
|
7774
|
+
* Functions
|
|
7775
|
+
*
|
|
7776
|
+
* */
|
|
7777
|
+
/* eslint-disable valid-jsdoc */
|
|
7630
7778
|
/**
|
|
7631
7779
|
* @private
|
|
7632
7780
|
*/
|
|
@@ -7638,49 +7786,11 @@
|
|
|
7638
7786
|
chart.rangeSelector.minInput &&
|
|
7639
7787
|
chart.rangeSelector.maxInput);
|
|
7640
7788
|
}
|
|
7641
|
-
|
|
7642
|
-
* Highlight range selector button by index.
|
|
7643
|
-
*
|
|
7644
|
-
* @private
|
|
7645
|
-
* @function Highcharts.Chart#highlightRangeSelectorButton
|
|
7789
|
+
/* *
|
|
7646
7790
|
*
|
|
7647
|
-
*
|
|
7791
|
+
* Class
|
|
7648
7792
|
*
|
|
7649
|
-
*
|
|
7650
|
-
*/
|
|
7651
|
-
Chart.prototype.highlightRangeSelectorButton = function (ix) {
|
|
7652
|
-
var buttons = (this.rangeSelector &&
|
|
7653
|
-
this.rangeSelector.buttons ||
|
|
7654
|
-
[]);
|
|
7655
|
-
var curHighlightedIx = this.highlightedRangeSelectorItemIx;
|
|
7656
|
-
var curSelectedIx = (this.rangeSelector &&
|
|
7657
|
-
this.rangeSelector.selected);
|
|
7658
|
-
// Deselect old
|
|
7659
|
-
if (typeof curHighlightedIx !== 'undefined' &&
|
|
7660
|
-
buttons[curHighlightedIx] &&
|
|
7661
|
-
curHighlightedIx !== curSelectedIx) {
|
|
7662
|
-
buttons[curHighlightedIx].setState(this.oldRangeSelectorItemState || 0);
|
|
7663
|
-
}
|
|
7664
|
-
// Select new
|
|
7665
|
-
this.highlightedRangeSelectorItemIx = ix;
|
|
7666
|
-
if (buttons[ix]) {
|
|
7667
|
-
this.setFocusToElement(buttons[ix].box, buttons[ix].element);
|
|
7668
|
-
if (ix !== curSelectedIx) {
|
|
7669
|
-
this.oldRangeSelectorItemState = buttons[ix].state;
|
|
7670
|
-
buttons[ix].setState(1);
|
|
7671
|
-
}
|
|
7672
|
-
return true;
|
|
7673
|
-
}
|
|
7674
|
-
return false;
|
|
7675
|
-
};
|
|
7676
|
-
// Range selector does not have destroy-setup for class instance events - so
|
|
7677
|
-
// we set it on the class and call the component from here.
|
|
7678
|
-
addEvent(RangeSelector, 'afterBtnClick', function () {
|
|
7679
|
-
if (this.chart.accessibility &&
|
|
7680
|
-
this.chart.accessibility.components.rangeSelector) {
|
|
7681
|
-
return this.chart.accessibility.components.rangeSelector.onAfterBtnClick();
|
|
7682
|
-
}
|
|
7683
|
-
});
|
|
7793
|
+
* */
|
|
7684
7794
|
/**
|
|
7685
7795
|
* The RangeSelectorComponent class
|
|
7686
7796
|
*
|
|
@@ -7688,21 +7798,37 @@
|
|
|
7688
7798
|
* @class
|
|
7689
7799
|
* @name Highcharts.RangeSelectorComponent
|
|
7690
7800
|
*/
|
|
7691
|
-
var RangeSelectorComponent = function () {
|
|
7692
|
-
|
|
7693
|
-
|
|
7801
|
+
var RangeSelectorComponent = /** @class */ (function (_super) {
|
|
7802
|
+
__extends(RangeSelectorComponent, _super);
|
|
7803
|
+
function RangeSelectorComponent() {
|
|
7804
|
+
/* *
|
|
7805
|
+
*
|
|
7806
|
+
* Properties
|
|
7807
|
+
*
|
|
7808
|
+
* */
|
|
7809
|
+
var _this = _super !== null && _super.apply(this,
|
|
7810
|
+
arguments) || this;
|
|
7811
|
+
_this.announcer = void 0;
|
|
7812
|
+
return _this;
|
|
7813
|
+
}
|
|
7814
|
+
/* *
|
|
7815
|
+
*
|
|
7816
|
+
* Functions
|
|
7817
|
+
*
|
|
7818
|
+
* */
|
|
7819
|
+
/* eslint-disable valid-jsdoc */
|
|
7694
7820
|
/**
|
|
7695
7821
|
* Init the component
|
|
7696
7822
|
* @private
|
|
7697
7823
|
*/
|
|
7698
|
-
init
|
|
7824
|
+
RangeSelectorComponent.prototype.init = function () {
|
|
7699
7825
|
var chart = this.chart;
|
|
7700
7826
|
this.announcer = new Announcer(chart, 'polite');
|
|
7701
|
-
}
|
|
7827
|
+
};
|
|
7702
7828
|
/**
|
|
7703
7829
|
* Called on first render/updates to the chart, including options changes.
|
|
7704
7830
|
*/
|
|
7705
|
-
onChartUpdate
|
|
7831
|
+
RangeSelectorComponent.prototype.onChartUpdate = function () {
|
|
7706
7832
|
var chart = this.chart,
|
|
7707
7833
|
component = this,
|
|
7708
7834
|
rangeSelector = chart.rangeSelector;
|
|
@@ -7728,12 +7854,12 @@
|
|
|
7728
7854
|
}
|
|
7729
7855
|
});
|
|
7730
7856
|
}
|
|
7731
|
-
}
|
|
7857
|
+
};
|
|
7732
7858
|
/**
|
|
7733
7859
|
* Hide buttons from AT when showing dropdown, and vice versa.
|
|
7734
7860
|
* @private
|
|
7735
7861
|
*/
|
|
7736
|
-
updateSelectorVisibility
|
|
7862
|
+
RangeSelectorComponent.prototype.updateSelectorVisibility = function () {
|
|
7737
7863
|
var chart = this.chart;
|
|
7738
7864
|
var rangeSelector = chart.rangeSelector;
|
|
7739
7865
|
var dropdown = (rangeSelector &&
|
|
@@ -7755,12 +7881,12 @@
|
|
|
7755
7881
|
}
|
|
7756
7882
|
buttons.forEach(function (btn) { return unhideChartElementFromAT(chart, btn.element); });
|
|
7757
7883
|
}
|
|
7758
|
-
}
|
|
7884
|
+
};
|
|
7759
7885
|
/**
|
|
7760
7886
|
* Set accessibility related attributes on dropdown element.
|
|
7761
7887
|
* @private
|
|
7762
7888
|
*/
|
|
7763
|
-
setDropdownAttrs
|
|
7889
|
+
RangeSelectorComponent.prototype.setDropdownAttrs = function () {
|
|
7764
7890
|
var chart = this.chart;
|
|
7765
7891
|
var dropdown = (chart.rangeSelector &&
|
|
7766
7892
|
chart.rangeSelector.dropdown);
|
|
@@ -7769,34 +7895,34 @@
|
|
|
7769
7895
|
dropdown.setAttribute('aria-label', label);
|
|
7770
7896
|
dropdown.setAttribute('tabindex', -1);
|
|
7771
7897
|
}
|
|
7772
|
-
}
|
|
7898
|
+
};
|
|
7773
7899
|
/**
|
|
7774
7900
|
* @private
|
|
7775
7901
|
* @param {Highcharts.SVGElement} button
|
|
7776
7902
|
*/
|
|
7777
|
-
setRangeButtonAttrs
|
|
7903
|
+
RangeSelectorComponent.prototype.setRangeButtonAttrs = function (button) {
|
|
7778
7904
|
attr(button.element, {
|
|
7779
7905
|
tabindex: -1,
|
|
7780
7906
|
role: 'button'
|
|
7781
7907
|
});
|
|
7782
|
-
}
|
|
7908
|
+
};
|
|
7783
7909
|
/**
|
|
7784
7910
|
* @private
|
|
7785
7911
|
*/
|
|
7786
|
-
setRangeInputAttrs
|
|
7912
|
+
RangeSelectorComponent.prototype.setRangeInputAttrs = function (input, langKey) {
|
|
7787
7913
|
var chart = this.chart;
|
|
7788
7914
|
attr(input, {
|
|
7789
7915
|
tabindex: -1,
|
|
7790
7916
|
'aria-label': chart.langFormat(langKey, { chart: chart })
|
|
7791
7917
|
});
|
|
7792
|
-
}
|
|
7918
|
+
};
|
|
7793
7919
|
/**
|
|
7794
7920
|
* @private
|
|
7795
7921
|
* @param {Highcharts.KeyboardNavigationHandler} keyboardNavigationHandler
|
|
7796
7922
|
* @param {number} keyCode
|
|
7797
7923
|
* @return {number} Response code
|
|
7798
7924
|
*/
|
|
7799
|
-
onButtonNavKbdArrowKey
|
|
7925
|
+
RangeSelectorComponent.prototype.onButtonNavKbdArrowKey = function (keyboardNavigationHandler, keyCode) {
|
|
7800
7926
|
var response = keyboardNavigationHandler.response,
|
|
7801
7927
|
keys = this.keyCodes,
|
|
7802
7928
|
chart = this.chart,
|
|
@@ -7812,11 +7938,11 @@
|
|
|
7812
7938
|
return response[direction > 0 ? 'next' : 'prev'];
|
|
7813
7939
|
}
|
|
7814
7940
|
return response.success;
|
|
7815
|
-
}
|
|
7941
|
+
};
|
|
7816
7942
|
/**
|
|
7817
7943
|
* @private
|
|
7818
7944
|
*/
|
|
7819
|
-
onButtonNavKbdClick
|
|
7945
|
+
RangeSelectorComponent.prototype.onButtonNavKbdClick = function (keyboardNavigationHandler) {
|
|
7820
7946
|
var response = keyboardNavigationHandler.response,
|
|
7821
7947
|
chart = this.chart,
|
|
7822
7948
|
wasDisabled = chart.oldRangeSelectorItemState === 3;
|
|
@@ -7824,13 +7950,13 @@
|
|
|
7824
7950
|
this.fakeClickEvent(chart.rangeSelector.buttons[chart.highlightedRangeSelectorItemIx].element);
|
|
7825
7951
|
}
|
|
7826
7952
|
return response.success;
|
|
7827
|
-
}
|
|
7953
|
+
};
|
|
7828
7954
|
/**
|
|
7829
7955
|
* Called whenever a range selector button has been clicked, either by
|
|
7830
7956
|
* mouse, touch, or kbd/voice/other.
|
|
7831
7957
|
* @private
|
|
7832
7958
|
*/
|
|
7833
|
-
onAfterBtnClick
|
|
7959
|
+
RangeSelectorComponent.prototype.onAfterBtnClick = function () {
|
|
7834
7960
|
var chart = this.chart;
|
|
7835
7961
|
var axisRangeDescription = getAxisRangeDescription(chart.xAxis[0]);
|
|
7836
7962
|
var announcement = chart.langFormat('accessibility.rangeSelector.clickButtonAnnouncement', { chart: chart,
|
|
@@ -7838,11 +7964,11 @@
|
|
|
7838
7964
|
if (announcement) {
|
|
7839
7965
|
this.announcer.announce(announcement);
|
|
7840
7966
|
}
|
|
7841
|
-
}
|
|
7967
|
+
};
|
|
7842
7968
|
/**
|
|
7843
7969
|
* @private
|
|
7844
7970
|
*/
|
|
7845
|
-
onInputKbdMove
|
|
7971
|
+
RangeSelectorComponent.prototype.onInputKbdMove = function (direction) {
|
|
7846
7972
|
var chart = this.chart;
|
|
7847
7973
|
var rangeSel = chart.rangeSelector;
|
|
7848
7974
|
var newIx = chart.highlightedInputRangeIx = (chart.highlightedInputRangeIx || 0) + direction;
|
|
@@ -7860,12 +7986,12 @@
|
|
|
7860
7986
|
chart.setFocusToElement(svgEl, inputEl);
|
|
7861
7987
|
}
|
|
7862
7988
|
}
|
|
7863
|
-
}
|
|
7989
|
+
};
|
|
7864
7990
|
/**
|
|
7865
7991
|
* @private
|
|
7866
7992
|
* @param {number} direction
|
|
7867
7993
|
*/
|
|
7868
|
-
onInputNavInit
|
|
7994
|
+
RangeSelectorComponent.prototype.onInputNavInit = function (direction) {
|
|
7869
7995
|
var _this = this;
|
|
7870
7996
|
var component = this;
|
|
7871
7997
|
var chart = this.chart;
|
|
@@ -7901,11 +8027,11 @@
|
|
|
7901
8027
|
maxRemover_1();
|
|
7902
8028
|
};
|
|
7903
8029
|
}
|
|
7904
|
-
}
|
|
8030
|
+
};
|
|
7905
8031
|
/**
|
|
7906
8032
|
* @private
|
|
7907
8033
|
*/
|
|
7908
|
-
onInputNavTerminate
|
|
8034
|
+
RangeSelectorComponent.prototype.onInputNavTerminate = function () {
|
|
7909
8035
|
var rangeSel = (this.chart.rangeSelector || {});
|
|
7910
8036
|
if (rangeSel.maxInput) {
|
|
7911
8037
|
rangeSel.hideInput('max');
|
|
@@ -7917,11 +8043,11 @@
|
|
|
7917
8043
|
this.removeInputKeydownHandler();
|
|
7918
8044
|
delete this.removeInputKeydownHandler;
|
|
7919
8045
|
}
|
|
7920
|
-
}
|
|
8046
|
+
};
|
|
7921
8047
|
/**
|
|
7922
8048
|
* @private
|
|
7923
8049
|
*/
|
|
7924
|
-
initDropdownNav
|
|
8050
|
+
RangeSelectorComponent.prototype.initDropdownNav = function () {
|
|
7925
8051
|
var _this = this;
|
|
7926
8052
|
var chart = this.chart;
|
|
7927
8053
|
var rangeSelector = chart.rangeSelector;
|
|
@@ -7945,13 +8071,13 @@
|
|
|
7945
8071
|
}
|
|
7946
8072
|
});
|
|
7947
8073
|
}
|
|
7948
|
-
}
|
|
8074
|
+
};
|
|
7949
8075
|
/**
|
|
7950
8076
|
* Get navigation for the range selector buttons.
|
|
7951
8077
|
* @private
|
|
7952
8078
|
* @return {Highcharts.KeyboardNavigationHandler} The module object.
|
|
7953
8079
|
*/
|
|
7954
|
-
getRangeSelectorButtonNavigation
|
|
8080
|
+
RangeSelectorComponent.prototype.getRangeSelectorButtonNavigation = function () {
|
|
7955
8081
|
var chart = this.chart;
|
|
7956
8082
|
var keys = this.keyCodes;
|
|
7957
8083
|
var component = this;
|
|
@@ -7992,14 +8118,14 @@
|
|
|
7992
8118
|
}
|
|
7993
8119
|
}
|
|
7994
8120
|
});
|
|
7995
|
-
}
|
|
8121
|
+
};
|
|
7996
8122
|
/**
|
|
7997
8123
|
* Get navigation for the range selector input boxes.
|
|
7998
8124
|
* @private
|
|
7999
8125
|
* @return {Highcharts.KeyboardNavigationHandler}
|
|
8000
8126
|
* The module object.
|
|
8001
8127
|
*/
|
|
8002
|
-
getRangeSelectorInputNavigation
|
|
8128
|
+
RangeSelectorComponent.prototype.getRangeSelectorInputNavigation = function () {
|
|
8003
8129
|
var chart = this.chart;
|
|
8004
8130
|
var component = this;
|
|
8005
8131
|
return new KeyboardNavigationHandler(chart, {
|
|
@@ -8014,22 +8140,22 @@
|
|
|
8014
8140
|
component.onInputNavTerminate();
|
|
8015
8141
|
}
|
|
8016
8142
|
});
|
|
8017
|
-
}
|
|
8143
|
+
};
|
|
8018
8144
|
/**
|
|
8019
8145
|
* Get keyboard navigation handlers for this component.
|
|
8020
8146
|
* @return {Array<Highcharts.KeyboardNavigationHandler>}
|
|
8021
8147
|
* List of module objects.
|
|
8022
8148
|
*/
|
|
8023
|
-
getKeyboardNavigation
|
|
8149
|
+
RangeSelectorComponent.prototype.getKeyboardNavigation = function () {
|
|
8024
8150
|
return [
|
|
8025
8151
|
this.getRangeSelectorButtonNavigation(),
|
|
8026
8152
|
this.getRangeSelectorInputNavigation()
|
|
8027
8153
|
];
|
|
8028
|
-
}
|
|
8154
|
+
};
|
|
8029
8155
|
/**
|
|
8030
8156
|
* Remove component traces
|
|
8031
8157
|
*/
|
|
8032
|
-
destroy
|
|
8158
|
+
RangeSelectorComponent.prototype.destroy = function () {
|
|
8033
8159
|
if (this.removeDropdownKeydownHandler) {
|
|
8034
8160
|
this.removeDropdownKeydownHandler();
|
|
8035
8161
|
}
|
|
@@ -8039,8 +8165,99 @@
|
|
|
8039
8165
|
if (this.announcer) {
|
|
8040
8166
|
this.announcer.destroy();
|
|
8041
8167
|
}
|
|
8168
|
+
};
|
|
8169
|
+
return RangeSelectorComponent;
|
|
8170
|
+
}(AccessibilityComponent));
|
|
8171
|
+
/* *
|
|
8172
|
+
*
|
|
8173
|
+
* Class Namespace
|
|
8174
|
+
*
|
|
8175
|
+
* */
|
|
8176
|
+
(function (RangeSelectorComponent) {
|
|
8177
|
+
/* *
|
|
8178
|
+
*
|
|
8179
|
+
* Declarations
|
|
8180
|
+
*
|
|
8181
|
+
* */
|
|
8182
|
+
/* *
|
|
8183
|
+
*
|
|
8184
|
+
* Constants
|
|
8185
|
+
*
|
|
8186
|
+
* */
|
|
8187
|
+
var composedClasses = [];
|
|
8188
|
+
/* *
|
|
8189
|
+
*
|
|
8190
|
+
* Functions
|
|
8191
|
+
*
|
|
8192
|
+
* */
|
|
8193
|
+
/* eslint-disable valid-jsdoc */
|
|
8194
|
+
/**
|
|
8195
|
+
* Highlight range selector button by index.
|
|
8196
|
+
*
|
|
8197
|
+
* @private
|
|
8198
|
+
* @function Highcharts.Chart#highlightRangeSelectorButton
|
|
8199
|
+
*
|
|
8200
|
+
* @param {number} ix
|
|
8201
|
+
*
|
|
8202
|
+
* @return {boolean}
|
|
8203
|
+
*/
|
|
8204
|
+
function chartHighlightRangeSelectorButton(ix) {
|
|
8205
|
+
var buttons = (this.rangeSelector &&
|
|
8206
|
+
this.rangeSelector.buttons ||
|
|
8207
|
+
[]);
|
|
8208
|
+
var curHighlightedIx = this.highlightedRangeSelectorItemIx;
|
|
8209
|
+
var curSelectedIx = (this.rangeSelector &&
|
|
8210
|
+
this.rangeSelector.selected);
|
|
8211
|
+
// Deselect old
|
|
8212
|
+
if (typeof curHighlightedIx !== 'undefined' &&
|
|
8213
|
+
buttons[curHighlightedIx] &&
|
|
8214
|
+
curHighlightedIx !== curSelectedIx) {
|
|
8215
|
+
buttons[curHighlightedIx].setState(this.oldRangeSelectorItemState || 0);
|
|
8216
|
+
}
|
|
8217
|
+
// Select new
|
|
8218
|
+
this.highlightedRangeSelectorItemIx = ix;
|
|
8219
|
+
if (buttons[ix]) {
|
|
8220
|
+
this.setFocusToElement(buttons[ix].box, buttons[ix].element);
|
|
8221
|
+
if (ix !== curSelectedIx) {
|
|
8222
|
+
this.oldRangeSelectorItemState = buttons[ix].state;
|
|
8223
|
+
buttons[ix].setState(1);
|
|
8224
|
+
}
|
|
8225
|
+
return true;
|
|
8226
|
+
}
|
|
8227
|
+
return false;
|
|
8042
8228
|
}
|
|
8043
|
-
|
|
8229
|
+
/**
|
|
8230
|
+
* @private
|
|
8231
|
+
*/
|
|
8232
|
+
function compose(ChartClass, RangeSelectorClass) {
|
|
8233
|
+
if (composedClasses.indexOf(ChartClass) === -1) {
|
|
8234
|
+
composedClasses.push(ChartClass);
|
|
8235
|
+
var chartProto = ChartClass.prototype;
|
|
8236
|
+
chartProto.highlightRangeSelectorButton = chartHighlightRangeSelectorButton;
|
|
8237
|
+
}
|
|
8238
|
+
if (composedClasses.indexOf(RangeSelectorClass) === -1) {
|
|
8239
|
+
composedClasses.push(RangeSelectorClass);
|
|
8240
|
+
addEvent(RangeSelector, 'afterBtnClick', rangeSelectorAfterBtnClick);
|
|
8241
|
+
}
|
|
8242
|
+
}
|
|
8243
|
+
RangeSelectorComponent.compose = compose;
|
|
8244
|
+
/**
|
|
8245
|
+
* Range selector does not have destroy-setup for class instance events - so
|
|
8246
|
+
* we set it on the class and call the component from here.
|
|
8247
|
+
* @private
|
|
8248
|
+
*/
|
|
8249
|
+
function rangeSelectorAfterBtnClick() {
|
|
8250
|
+
if (this.chart.accessibility &&
|
|
8251
|
+
this.chart.accessibility.components.rangeSelector) {
|
|
8252
|
+
return this.chart.accessibility.components.rangeSelector.onAfterBtnClick();
|
|
8253
|
+
}
|
|
8254
|
+
}
|
|
8255
|
+
})(RangeSelectorComponent || (RangeSelectorComponent = {}));
|
|
8256
|
+
/* *
|
|
8257
|
+
*
|
|
8258
|
+
* Export Default
|
|
8259
|
+
*
|
|
8260
|
+
* */
|
|
8044
8261
|
|
|
8045
8262
|
return RangeSelectorComponent;
|
|
8046
8263
|
});
|
|
@@ -11458,12 +11675,16 @@
|
|
|
11458
11675
|
/**
|
|
11459
11676
|
* @private
|
|
11460
11677
|
*/
|
|
11461
|
-
function compose(ChartClass, PointClass, SeriesClass, SVGElementClass) {
|
|
11678
|
+
function compose(ChartClass, PointClass, SeriesClass, SVGElementClass, RangeSelectorClass) {
|
|
11462
11679
|
A11yI18n.compose(ChartClass);
|
|
11463
11680
|
FocusBorder.compose(ChartClass, SVGElementClass);
|
|
11464
11681
|
KeyboardNavigation.compose(ChartClass);
|
|
11682
|
+
MenuComponent.compose(ChartClass);
|
|
11465
11683
|
NewDataAnnouncer.compose(SeriesClass);
|
|
11466
11684
|
SeriesComponent.compose(ChartClass, PointClass, SeriesClass);
|
|
11685
|
+
if (RangeSelectorClass) {
|
|
11686
|
+
RangeSelectorComponent.compose(ChartClass, RangeSelectorClass);
|
|
11687
|
+
}
|
|
11467
11688
|
if (composedClasses.indexOf(ChartClass) === -1) {
|
|
11468
11689
|
composedClasses.push(ChartClass);
|
|
11469
11690
|
var chartProto = ChartClass.prototype;
|
|
@@ -11543,7 +11764,7 @@
|
|
|
11543
11764
|
G.AccessibilityComponent = AccessibilityComponent;
|
|
11544
11765
|
G.KeyboardNavigationHandler = KeyboardNavigationHandler;
|
|
11545
11766
|
G.SeriesAccessibilityDescriber = SeriesDescriber;
|
|
11546
|
-
Accessibility.compose(G.Chart, G.Point, G.Series, G.SVGElement);
|
|
11767
|
+
Accessibility.compose(G.Chart, G.Point, G.Series, G.SVGElement, G.RangeSelector);
|
|
11547
11768
|
|
|
11548
11769
|
});
|
|
11549
11770
|
}));
|