Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
fix(viewer): announce successful Lens copy to assistive readers
HengYang4a99e4a06563
diff --git a/archify/assets/template.html b/archify/assets/template.htmlindex 5e523fc5..74a475db 100644--- a/archify/assets/template.html+++ b/archify/assets/template.html@@ -13892,7 +13892,7 @@ OTHER DEALINGS IN THE FONT SOFTWARE.var value = readerLink('lens=' + selectedKinds.map(encodeURIComponent).join('~'));return (value === null ? Promise.resolve(false) : copyReaderText(value)).then(function (copied) {copyBtn.textContent = viewerText(copied ? 'viewer.common.copied' : 'viewer.common.copyFailed');- copyBtn.setAttribute('aria-label', viewerText(copied ? 'viewer.lens.copy' : 'viewer.common.copyFailed'));+ copyBtn.setAttribute('aria-label', viewerText(copied ? 'viewer.common.copied' : 'viewer.common.copyFailed'));window.setTimeout(function () {copyBtn.textContent = viewerText('viewer.common.copyLink');copyBtn.setAttribute('aria-label', viewerText('viewer.lens.copy'));diff --git a/test/semantic-lens-browser.test.mjs b/test/semantic-lens-browser.test.mjsindex ceacfacf..48a6febb 100644--- a/test/semantic-lens-browser.test.mjs+++ b/test/semantic-lens-browser.test.mjs@@ -265,6 +265,7 @@ test('Semantic Lens preserves selection, legend preview and panel contracts', {await run(`Archify.semanticLens.select('backend',{updateUrl:false})`);assert.equal(await run('location.hash'), '#unrelated=1');await run(`Archify.semanticLens.select('database')`); assert.equal(await run('location.search'), '?theme=dark&keep=yes');+ const idleCopyLabel = await run(`document.getElementById('semantic-lens-copy').getAttribute('aria-label')`);// Never touch the host clipboard: replace both the preferred API and fallback.for (const mode of ['success', 'reject', 'absent', 'failure', 'throw']) {const copied = await run(`(async()=>{@@ -272,13 +273,15 @@ test('Semantic Lens preserves selection, legend preview and panel contracts', {const expected=location.href.replace(/#.*$/,'')+'#lens=backend~database';Object.defineProperty(navigator,'clipboard',{configurable:true,value:${mode === 'success' ? "{writeText:v=>{captured=v;return Promise.resolve();}}" : mode === 'reject' ? "{writeText:()=>Promise.reject(new Error('fixture'))}" : 'undefined'}});document.execCommand=command=>{commands++;captured=document.activeElement.value;if(${JSON.stringify(mode)}==='throw')throw new Error('fixture');return ${JSON.stringify(mode)}!=='failure';};- try {const value=await Archify.semanticLens.copyLink();return {value,commands,correct:captured===expected,fields:document.querySelectorAll('textarea[readonly]').length,text:document.getElementById('semantic-lens-copy').textContent};}+ try {const value=await Archify.semanticLens.copyLink();return {value,commands,correct:captured===expected,fields:document.querySelectorAll('textarea[readonly]').length,text:document.getElementById('semantic-lens-copy').textContent,label:document.getElementById('semantic-lens-copy').getAttribute('aria-label')};}finally {document.execCommand=exec;if(descriptor)Object.defineProperty(navigator,'clipboard',descriptor);else delete navigator.clipboard;}})()`);assert.equal(copied.value, !['failure', 'throw'].includes(mode)); assert.equal(copied.commands, mode === 'success' ? 0 : 1);assert.equal(copied.correct, true); assert.equal(copied.fields, 0);assert.match(copied.text, copied.value ? /Copied/ : /Copy failed/i);+ assert.equal(copied.label, copied.text, 'accessible copy feedback matches the visible result');await run(`lensWait(()=>document.getElementById('semantic-lens-copy').textContent==='Copy link')`);+ assert.equal(await run(`document.getElementById('semantic-lens-copy').getAttribute('aria-label')`), idleCopyLabel);records.push({ scenario: 'copy-' + mode, ...copied });}await snapshot('copy-feedback-restored');diff --git a/viewer/semantic-lens.js b/viewer/semantic-lens.jsindex caa76f9e..2c4d911e 100644--- a/viewer/semantic-lens.js+++ b/viewer/semantic-lens.js@@ -524,7 +524,7 @@var value = readerLink('lens=' + selectedKinds.map(encodeURIComponent).join('~'));return (value === null ? Promise.resolve(false) : copyReaderText(value)).then(function (copied) {copyBtn.textContent = viewerText(copied ? 'viewer.common.copied' : 'viewer.common.copyFailed');- copyBtn.setAttribute('aria-label', viewerText(copied ? 'viewer.lens.copy' : 'viewer.common.copyFailed'));+ copyBtn.setAttribute('aria-label', viewerText(copied ? 'viewer.common.copied' : 'viewer.common.copyFailed'));window.setTimeout(function () {copyBtn.textContent = viewerText('viewer.common.copyLink');copyBtn.setAttribute('aria-label', viewerText('viewer.lens.copy'));