Skip to content

Disable copy button when it is denied/disabled#5285

Merged
compulim merged 4 commits intomainfrom
feat-disable-copy-button
Sep 6, 2024
Merged

Disable copy button when it is denied/disabled#5285
compulim merged 4 commits intomainfrom
feat-disable-copy-button

Conversation

@compulim
Copy link
Copy Markdown
Contributor

@compulim compulim commented Sep 6, 2024

Fixes #5283.

Changelog Entry

Added

  • Added "Copy" button to bot messages in Fluent UI if it contains keyword AllowCopy, in PR #5259, #5262, and #5285, by @compulim

Description

When the "Copy" button is disabled or denied permission, it should be disabled.

When Web Chat is inside an <iframe> without allow="clipboard-write", the permission will be automatically denied.

Design

The "Copy" button is disabled until after the permission check completed and is granted permission for clipboard-write.

Specific Changes

  • Used aria-disabled instead of disabled attribute
  • Added permission check and use uiState to determine if the button should be disabled
  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

Comment thread __tests__/html/copyButton.denied.html
OEvgeny
OEvgeny previously approved these changes Sep 6, 2024
@compulim compulim marked this pull request as ready for review September 6, 2024 20:00
@compulim compulim merged commit 3faa7a6 into main Sep 6, 2024
@compulim compulim deleted the feat-disable-copy-button branch September 6, 2024 20:12
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.

[Copy button] Disable copy button when it do nothing

2 participants