Screen Readers and JavaScript Print Function

I wrote a JavaScript print function for a web page. It extracts HTML from a hidden div on the page, displays it in a new window, and launches the print dialog. A.

This option is provided through buttonwith the event onclick="printTheThing()". I know that, for example, screen readers have some caveats with JavaScript. I am wondering if / how many people, such as the blind or sight, can block the use of this function.

The implementation opens a new browser window and is added to its document:

function printTheThing() {
    var dispSettings = "toolbar=yes,location=no,directories=yes,menubar=yes,"
        + "scrollbars=yes,width=550,height=400",
        html = $('#theDivToPrint').html(),
        printWindow = window.open("", "", dispSettings),
        doc = printWindow.document;

    doc.open();
    try {
        doc.write('<html><head>');
        doc.write('<title>' + title + '</title>');
        doc.write('</head><body>');
        doc.write(html);
        doc.write('</body></html>');
    } finally {
        doc.close();
    }
    printWindow.focus();
    printWindow.print();
}

Update: this is what the button looks like:

<button type="button" onclick="printTheThing()">Print the thing!</button>

, CSS . Firefox "". , . Fangs , .

+3
4

, , W3C WAI-ARIA, . FAQ.

, :
Windows - JAWS, NVDA
Linux - orca ( Chromium) + Florian Margaine

AChecker WCAG 2.0, 508, Stanca Act.

+1

Chrome. NVDA, . , Google , Chrome Vox . , AT 15 .

, , JS... JS . , .

+4

A way to display a print page is to use @mediaCSS directives . This way, you don’t need to do anything special, like popping up in another window or worrying about accessibility: the content just prints correctly (and maybe not at all as shown on the screen),

+1
source

All Articles