JSFiddle - React, Tailwind, and code Playground

by maritavindedal

HTML

<div tabindex="0">
This text (and the rest of the page in browser) becomes unreachable by tab after Menu -> Print Chart -> Cancel. Shift+tab can sometimes get back here.
</div>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<script src="http://code.highcharts.com/modules/accessibility.js"></script>
<div id="container1" style="min-width: 310px; height: 400px; margin: 0 auto"></div>

CSS

@media print {
    div {
        display:block;
    }
}

JavaScript

$(function () {
    (function (H) {
        H.wrap(H.Chart.prototype, 'print', function (proceed) {
            var chart = this,
                container = chart.container,
                origDisplay = [],
                win = window,
                origParent = container.parentNode,
                body = document.body,
                childNodes = body.childNodes;

            if (chart.isPrinting) { // block the button while in printing mode
                return;
            }

            chart.isPrinting = true;


            // print
            win.focus(); // #1510
            win.print();

            // allow the browser to prepare before reverting
            setTimeout(function () {

                // put the chart back in
                chart.afterPrint();
                //origParent.appendChild(container);


                chart.isPrinting = false;

            }, 1000);

        });
    })(Highcharts);

    $('#container1').highcharts({
        title: {
            text: 'Monthly Average Temperature',
            x: -20 //center
        },
        subtitle: {
            text: 'Source: WorldClimate.com',
            x: -20
        },
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
                'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
        },
        yAxis: {
            title: {
                text: 'Temperature (°C)'
            },
            plotLines: [{
                value: 0,
                width: 1,
                color: '#808080'
            }]
        },
        tooltip: {
            valueSuffix: '°C'
        },
        legend: {
            layout: 'vertical',
            align: 'right',
            verticalAlign: 'middle',
            borderWidth: 0
        },
        series: [{
            name: 'Tokyo',
            data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
        }, {
            name: 'New York',
            data: [-0.2, 0.8, 5.7, 11.3, 17.0,...