The awkward case for a Mac selection toolbar is a footnote in a scan. In a browser, the user can drag across a sentence and an app may expose the string through Accessibility. In a scanned PDF, the same drag may yield a rectangle of pixels. You want the toolbar to feel familiar in both cases, while keeping that rectangle on the Mac and making the translation request a deliberate choice.
Lassoly’s selection toolbar and browser playground illustrate that interaction. Its Mac client builds on GPL-3.0 Easydict for selection capture and on-device OCR. The design below is a reference architecture for anyone building a similar tool. The Swift example shows the OCR step. Easydict source and license .
Let selection create a candidate
Check Accessibility permission during setup and explain the feature that needs it. Use the focused Accessibility element to ask for the selected string. When the application exposes a selection range and useful bounds, you can position the toolbar around it.…