summaryrefslogtreecommitdiff
path: root/docs/_static/js
AgeCommit message (Collapse)Author
2026-05-07fix(codecopier): guard UI updates against out-of-order async completionsYuriy Andamasov
Rapid re-clicks queue multiple `navigator.clipboard.writeText` promises; without a request token, an older promise resolving later can overwrite the newer click's UI (or have its 2-second timeout fire on the new click's state). Add a per-button `copyRequestId` that each click increments and captures locally; the success/failure UI flip and the revert-timeout body all bail out early if the captured token no longer matches the current one. Addresses CodeRabbit review feedback on PR #1890. \xf0\x9f\xa4\x96 Generated by [robots](https://vyos.io)
2026-05-07fix(codecopier): prevent state class crossover on rapid re-clicksYuriy Andamasov
Reset both notifier classes and cancel any pending revert timeout at the start of each click so a fast failure-then-success (or vice versa) can't leave `copiedNotifier` and `copyFailedNotifier` applied simultaneously, and so the 2-second auto-revert window restarts cleanly per click. Addresses Copilot review feedback on PR #1890. 🤖 Generated by [robots](https://vyos.io)
2026-05-07fix(codecopier): exclude Copy label from clipboard and stop showing false ↵Yuriy Andamasov
success Two real bugs in the docs site copy-to-clipboard handler, both flagged by copilot review on PR #1886 (deferred there because that PR is scoped to typos). Bug 1: Copy label leaked into copied snippets on narrow screens The handler read `currentTarget.offsetParent.innerText`. The same handler appends a visible `.copyDiv` (with a 'Copy' <p>) into that container. Below the 992px breakpoint the label is visible (see code-snippets.css .copyDiv > p) so users got 'Copy' appended to every copied snippet. Fix: extract text from the <pre> element inside the container instead, which excludes the injected button. Also switched the lookup root from `offsetParent` to `parentElement` so the source-of-truth is the DOM relationship (the .copyDiv is inserted as a beforeend child of the inner .highlight div via insertAdjacentHTML), not CSS positioning. Bug 2: Failed clipboard writes still showed 'Copied!' The try/catch only logged on failure but the surrounding code still flipped the button into the copiedNotifier success state. Users got false success when writeText rejected (insecure context, permission denied, etc.). Fix: move the success UI flip inside the try, add an explicit failure UI flip ('Failed' text + new `.copyFailedNotifier` class with red background) in the catch. setTimeout still reverts both classes after 2s. Verified in browser with a sphinx-rendered fixture (jQuery 3.7 + Pygments output): both snippets copy their own text without the Copy label, success flow shows Copied!, simulated writeText rejection shows Failed, both states revert after 2s. 🤖 Generated by [robots](https://vyos.io)
2024-05-28Enable new design on sagittarebortg
2022-03-24improve coverage layoutrebortg