Inventor(s)

Abstract

A translation extension shows a small button after the user selects text on a web page, plus panels and other overlays. The 30 pixel button is anchored to the last line box of the selection rather than its bounding box. Its right edge sits 6 pixels inside the end of that line and its top 8 pixels below it, so it appears where reading stopped without covering the following words. On a short line it falls back to the line start, without room below it flips above the line, and it always stays inside the viewport. All overlays live in one shadow-DOM host element. To keep pages from covering them, the host is made a manual popover and shown, which places it in the browser's top layer above every z-index and above page dialogs or fullscreen elements opened earlier. The host is a zero-size fixed box, so it occupies no space and blocks no clicks while its children keep viewport positioning. Each time a window opens, the host is hidden and shown again in the same frame, moving it to the top of the top layer without flicker. Without popover support the overlays fall back to the maximum z-index.

Creative Commons License

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.

Share

COinS