Accessibility Statement Snippet Generator
Fill in the details below to generate a basic accessibility statement snippet for your website. The preview will update automatically.
Generated Snippet
Copied to clipboard!
The Web Content Accessibility Guidelines (WCAG) defines requirements for designers and developers to improve accessibility for people with disabilities. We aim to conform with ${standard}.
${measuresHtml}Feedback
We welcome your feedback on the accessibility of our website. Please let us know if you encounter accessibility barriers ${feedbackHtml}
${limitationsHtml}This statement was generated on ${new Date().toLocaleDateString()}.
`; // 6. Update preview area previewArea.innerHTML = finalHtml; }; // --- Event Listeners --- if (form) { form.addEventListener("input", generateStatement); form.addEventListener("change", generateStatement); // For select and checkboxes } // --- Button: Copy to Clipboard --- copyBtn.addEventListener("click", () => { // Use a temporary textarea to preserve formatting (like line breaks) const tempTextArea = document.createElement("textarea"); tempTextArea.value = previewArea.innerText; // .innerText is better than .textContent for line breaks document.body.appendChild(tempTextArea); tempTextArea.select(); try { document.execCommand("copy"); // Use specified fallback showToast("Copied to clipboard!"); } catch (err) { console.error("ASG Copy Error:", err); showToast("Failed to copy.", true); } document.body.removeChild(tempTextArea); }); // --- Button: Download PDF --- pdfBtn.addEventListener("click", () => { const { jsPDF } = window.jspdf; const pdfArea = toolContainer.querySelector("#asg-preview-area"); const org = orgName.value || "Accessibility-Statement"; const fileName = `${org.replace(/ /g, '_')}_Accessibility_Statement.pdf`; // Use html2canvas to capture the specific div html2canvas(pdfArea, { scale: 2, // Improve resolution useCORS: true, backgroundColor: '#ffffff' }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const doc = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = doc.internal.pageSize.getWidth(); const pdfHeight = doc.internal.pageSize.getHeight(); const imgProps = doc.getImageProperties(imgData); const imgWidth = imgProps.width; const imgHeight = imgProps.height; // Calculate ratio to fit A4 page width, with margins const margin = 40; // 40pt margin const usableWidth = pdfWidth - (2 * margin); const ratio = usableWidth / imgWidth; const scaledHeight = imgHeight * ratio; // Check if it fits on one page if (scaledHeight < pdfHeight - (2 * margin)) { doc.addImage(imgData, 'PNG', margin, margin, usableWidth, scaledHeight); } else { // Handle multi-page (simple split) let position = margin; const pageHeight = pdfHeight - (2 * margin); let heightLeft = scaledHeight; doc.addImage(imgData, 'PNG', margin, position, usableWidth, scaledHeight); heightLeft -= pageHeight; while (heightLeft > 0) { position = margin - heightLeft; doc.addPage(); doc.addImage(imgData, 'PNG', margin, position, usableWidth, scaledHeight); heightLeft -= pageHeight; } } doc.save(fileName); }).catch(err => { console.error("ASG PDF Error:", err); alert("An error occurred while generating the PDF."); }); }); // --- Utility: Show Toast Message --- let toastTimer; const showToast = (message, isError = false) => { if (!copyToast) return; clearTimeout(toastTimer); copyToast.textContent = message; copyToast.style.backgroundColor = isError ? "#dc3545" : "var(--asg-primary-color)"; copyToast.style.display = "block"; toastTimer = setTimeout(() => { copyToast.style.display = "none"; }, 2000); }; // --- Initial Load --- generateStatement(); // Populate with default values });