From 614ea65d6eb815f677bfaaeedb84a0cb60dede7b Mon Sep 17 00:00:00 2001 From: KAWAKAMI Moeki Date: Wed, 29 Apr 2026 09:23:28 +0900 Subject: [PATCH] swift/ax_text: include image alt text in browser capture Cosense's icon notation (e.g. [Claude Code.icon]) renders as Claude Code, which document.body.innerText silently skips. Replaces each img[alt] with a text node containing " [alt] " before reading innerText, so alt text now flows into capture in document order. Co-Authored-By: Claude Opus 4.7 --- swift/ax_text.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swift/ax_text.swift b/swift/ax_text.swift index d917d75..bbee0c0 100644 --- a/swift/ax_text.swift +++ b/swift/ax_text.swift @@ -93,7 +93,7 @@ func getBrowserTabTexts(appScriptName: String) -> [[String: Any]] { set u to URL of tab i of window w try tell tab i of window w - set txt to execute javascript "document.body.innerText.substring(0, 5000)" + set txt to execute javascript "(function(){var c=document.body.cloneNode(true);c.querySelectorAll('img[alt]').forEach(function(i){var a=(i.getAttribute('alt')||'').trim();if(a){i.parentNode.replaceChild(document.createTextNode(' ['+a+'] '),i);}});return c.innerText.substring(0,5000);})()" end tell on error set txt to ""