From 5561389767091740bf555bf4f07f9b04e19c7179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A1muel=20Fekete?= Date: Fri, 13 Dec 2024 23:10:37 +0100 Subject: [PATCH] feat: readd hc a11y correctly --- src/components/Charts/LineChart.tsx | 5 +++++ src/components/Charts/LineChartModal.tsx | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/components/Charts/LineChart.tsx b/src/components/Charts/LineChart.tsx index e8fd9a5e..5114e033 100644 --- a/src/components/Charts/LineChart.tsx +++ b/src/components/Charts/LineChart.tsx @@ -3,6 +3,7 @@ import { Button } from '@nextui-org/button'; import { useDisclosure } from '@nextui-org/modal'; import Highcharts from 'highcharts'; +import highchartsAccessibility from 'highcharts/modules/accessibility'; import HighchartsReact from 'highcharts-react-official'; import { Maximize4 } from 'iconsax-react'; import { useTheme } from 'next-themes'; @@ -18,6 +19,10 @@ import { LineChartData } from '@/domain/entities/charts/LineChartData'; import LineChartProps from '@/domain/props/LineChartProps'; import LineChartOperations from '@/operations/charts/LineChartOperations'; +if (typeof Highcharts === 'object') { + highchartsAccessibility(Highcharts); +} + /** * The LineChart component is a box that primarily renders a title, description text, and a line chart. * This component has a width of 100%, so it adjusts to the width of its parent element in which it is used. diff --git a/src/components/Charts/LineChartModal.tsx b/src/components/Charts/LineChartModal.tsx index 53412759..9fb58e7d 100644 --- a/src/components/Charts/LineChartModal.tsx +++ b/src/components/Charts/LineChartModal.tsx @@ -1,6 +1,7 @@ import { Button } from '@nextui-org/button'; import { Modal, ModalBody, ModalContent, ModalFooter, ModalHeader } from '@nextui-org/modal'; import Highcharts from 'highcharts'; +import highchartsAccessibility from 'highcharts/modules/accessibility'; import HighchartsReact from 'highcharts-react-official'; import { Minus } from 'iconsax-react'; import { useRef } from 'react'; @@ -12,6 +13,10 @@ import LineChartXAxisSlider from '@/components/Charts/helpers/LineChartXAxisSlid import { Tooltip } from '@/components/Tooltip/Tooltip'; import LineChartModalProps from '@/domain/props/LineChartModalProps'; +if (typeof Highcharts === 'object') { + highchartsAccessibility(Highcharts); +} + /** * This component is tied to the `LineChart` component and should not be used independently. * It renders the modal, which can be opened by the user from the `LineChart` to display the chart