webr
webr copied to clipboard
Support HTML help
Comment from @ajrgodfrey
Plain text help is difficult to navigate with a screen reader vs HTML
Also as a sighted user: as the panes can not be resized, have to use horizontal scroll or zoom out to see full width of plain text help files, making text harder to read on small screens.
Note: Generally displaying HTML content from the WebAssembly R process is currently unsupported.
See also #248.
Feel like this could be done via (reprex of producing html via webR and send to a new tab):
<html>
<head>
<title>WebR new window</title>
</head>
<body>
<p id="loading">This will open a new window</div>
<script type="module">
import { WebR } from 'https://webr.r-wasm.org/latest/webr.mjs';
const webR = new WebR();
await webR.init();
const html = await webR.evalR('"<h1>Hello world</h1>"');
const html_s = await html.toJs();
var newWindow = window.open();
newWindow.document.write(html_s.values[0]);
</script>
</body>
</html>
Happy to discuss and draft a PR around that
Another tab is fine. It is easily dismissed and less disruptive as the original (main) page doesn't get re-flowed.
I imagine a re-flow is not visually disruptive, but for screen reader users, the behaviour of alterations on screen can lead to the whole page being fed back into the virtual buffer which the screen reader engages with. The worst outcome when this occurs is that the screen reader starts reading the page from the top again.
One of the issue right now though is that R documentation contains hyperlink to other documentation parts. It works on standard R because R spins an internal web server and serves the whole documentation.
We might need to clean out the hyperlink from the html help pages if we go with this approach.