Highcharts test tool
HTML
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>
<input type="text" placeholder="Start focus here for testing" />
<div id="container"></div>
<button id="navToggleBtn">Disable Keyboard Navigation</button>
<button onclick="updateA11yEnabled()">Manually Update A11y</button>
CSS
#container {
min-width: 300px;
max-width: 800px;
height: 300px;
margin: 1em auto;
}
JavaScript
let keyboardNavEnabled = true;
const chart = Highcharts.chart('container', {
accessibility: {
keyboardNavigation: {
enabled: keyboardNavEnabled
}
},
navigation: {
buttonOptions: {
enabled: false
}
},
series: [{
data: [1, 4, 3, 5],
type: 'column'
}]
});
navToggleBtn.onclick = (evt) => {
if (chart.options.accessibility.keyboardNavigation.enabled) {
chart.update({
accessibility: {
keyboardNavigation: {
enabled: false
}
}
});
evt.target.textContent = "Enable Keyboard Navigation";
} else {
chart.update({
accessibility: {
keyboardNavigation: {
enabled: true
}
}
});
evt.target.textContent = "Disable Keyboard Navigation";
}
}
function updateA11yEnabled() {
chart.updateA11yEnabled();
}