Skip to content

[feat] Hover, active, focus-visible states for CopyButton#12348

Merged
sfc-gh-bnisco merged 2 commits intodevelopfrom
bnisco/update-copy-button
Aug 27, 2025
Merged

[feat] Hover, active, focus-visible states for CopyButton#12348
sfc-gh-bnisco merged 2 commits intodevelopfrom
bnisco/update-copy-button

Conversation

@sfc-gh-bnisco
Copy link
Copy Markdown
Collaborator

@sfc-gh-bnisco sfc-gh-bnisco commented Aug 27, 2025

Describe your changes

  • Adds an explicit hover, active, and focus-active CSS states for CopyButton
  • Adds a11y label

Dark mode:

Kapture.2025-08-27.at.08.50.40.mp4

Light mode:

Kapture.2025-08-27.at.08.51.22.mp4

Focus ring when keyboard focus:

Screenshot 2025-08-27 at 8 51 51 AM

GitHub Issue Link (if applicable)

Testing Plan

  • Manually tested. This is a small enough visual change that doesn't warrant a snapshot test. The behavioral aspects are already tested.

Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

@snyk-io
Copy link
Copy Markdown
Contributor

snyk-io bot commented Aug 27, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Aug 27, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12348/streamlit-1.48.1-py3-none-any.whl
🕹️ Preview app pr-12348.streamlit.app (☁️ Deploy here if not accessible)

@sfc-gh-bnisco sfc-gh-bnisco added security-assessment-completed change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users labels Aug 27, 2025
@sfc-gh-bnisco sfc-gh-bnisco requested a review from Copilot August 27, 2025 15:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the CopyButton component in CodeBlock with improved interactive states and accessibility features. The changes add proper hover, active, and focus-visible CSS states along with an accessible label that updates based on the copy state.

  • Separates hover states for the code block container vs. the button itself
  • Adds visual feedback with background colors and focus rings for better user experience
  • Improves accessibility with dynamic aria-label and proper button type

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
frontend/lib/src/components/elements/CodeBlock/styled-components.ts Refactors CSS selectors to separate container hover from button states, adds hover/active background colors and focus-visible ring
frontend/lib/src/components/elements/CodeBlock/CopyButton.tsx Adds dynamic aria-label and title that updates based on copy state, sets explicit button type

@sfc-gh-bnisco sfc-gh-bnisco marked this pull request as ready for review August 27, 2025 20:27
Copy link
Copy Markdown
Collaborator

@lukasmasuch lukasmasuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@sfc-gh-bnisco sfc-gh-bnisco merged commit aab3379 into develop Aug 27, 2025
36 checks passed
@sfc-gh-bnisco sfc-gh-bnisco deleted the bnisco/update-copy-button branch August 27, 2025 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:feature PR contains new feature or enhancement implementation impact:users PR changes affect end users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants