Skip to content

🎨 Palette: Copy Section Links#25

Open
MilakyS wants to merge 1 commit into
mainfrom
palette/docs-copy-links-254426008729261644
Open

🎨 Palette: Copy Section Links#25
MilakyS wants to merge 1 commit into
mainfrom
palette/docs-copy-links-254426008729261644

Conversation

@MilakyS
Copy link
Copy Markdown
Member

@MilakyS MilakyS commented May 21, 2026

🎨 Palette: [Copy Section Links]

💡 What:

Added section-specific "Copy Link" buttons to the documentation page. These buttons appear next to the "Overview" hero title and all individual documentation section/card headings.

🎯 Why:

This micro-UX improvement significantly enhances documentation shareability. Users can now easily grab a direct link to a specific section (e.g., #pointers or #booleans) without having to manually construct the URL or rely on the sidebar.

✨ Implementation Details:

  • Dynamic Injection: Buttons are injected during the documentation rendering phase in docs-page.js.
  • Event Delegation: docs.js uses a document-level listener to handle clicks, ensuring functionality even for dynamically rendered content.
  • Robust Clipboard Logic: Uses navigator.clipboard with a safe fallback to a hidden textarea for older browsers.
  • Visual Feedback: When clicked, the link icon transforms into a checkmark, and the button color changes for 1500ms to provide clear confirmation.

♿ Accessibility:

  • ARIA Labels: Buttons include aria-label and title attributes that update from "Copy link to section" to "Link copied" during the success state.
  • Keyboard Support: Buttons are reachable via Tab and have high-contrast :focus-visible indicators. Focus states also ensure the button remains visible for keyboard-only users.
  • Screen Reader Friendly: The temporary attribute updates provide audible feedback of the success state.

🛡️ Robustness:

  • Added leading semicolons and defensive window/document guards to all documentation-related scripts to prevent build-time failures in environments like Cloudflare Workers.
  • Used regex-based replacement for maximum compatibility.

PR created automatically by Jules for task 254426008729261644 started by @MilakyS

- Update assets/data/site.json with i18n strings for copy buttons (EN/RU).
- Inject copy buttons into docs-hero and section titles in assets/js/docs-page.js.
- Implement clipboard logic and visual/accessible feedback in assets/js/docs.js using event delegation.
- Style buttons in assets/css/docs.css with hover/focus states and success transitions.
- Add leading semicolons and defensive guards to documentation scripts for build stability.
- Record UX learning in .jules/palette.md.

Co-authored-by: MilakyS <155958485+MilakyS@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 21, 2026

Deploy Preview for melodious-queijadas-3cc817 ready!

Name Link
🔨 Latest commit ba22dbd
🔍 Latest deploy log https://app.netlify.com/projects/melodious-queijadas-3cc817/deploys/6a0e9ea84cfd3600083c9e04
😎 Deploy Preview https://deploy-preview-25--melodious-queijadas-3cc817.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant