Make every copy button follow the design system's copy-to-clipboard pattern
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, react
- Lĩnh vực
- developer-experience, frontend
Hướng nghiên cứu
Start with the listed copy controls in site-details.jsx, patch-diff-pane.jsx, logs-panel.jsx, pull-request-destination.jsx, and xdebug-setup-dialog.jsx, then trace their handlers in index.jsx and the hooks. Compare each control with the design system pattern linked in the issue and account for the stated @wordpress/compose version constraint. Update the named journey checks and remove copyButtonLabel when unused; done means every standalone control follows the pattern and menu copy keeps snackbar feedback.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Why
The design system has a copy-to-clipboard pattern (source), and the app's copy controls each do it a bit differently. This came up in review of #724.
What the pattern asks for
A standalone copy button:
variant="minimal",tone="neutral",size="compact".- Keeps its label. It isn't renamed to "Copied" while it has focus.
- Shows a check icon on success and an error icon on failure, for two seconds after each copy. Each copy restarts the timer.
- Announces the result with
speak(): "Copied to clipboard" or "Couldn't copy to clipboard." - No snackbar, no tooltip as the only feedback, no
aria-pressed. - Copies with
useCopyToClipboardfrom@wordpress/compose, using itsonErrorcallback for a failure.
A copy item in a menu shows its result in a snackbar, since the menu closes.
The copy controls in the app now
| Where | File | What it does now |
|---|---|---|
| Site details, Local path Copy | src/renderer/components/site-details.jsx |
Minimal button. Renamed to "Copied" for 1.5 seconds, said through a hidden live region. A failure shows an error toast. |
| Site menu, Copy path | src/renderer/index.jsx (copy-path) |
Menu item. Success and failure are toasts, which already fits the menu case. Check the wording. |
| Review dialog, patch Copy | src/renderer/components/patch-diff-pane.jsx, copyPatch in src/renderer/index.jsx |
Outline button. Renamed to "Copied" or "Could not copy" (copyButtonLabel in src/renderer/confirmations.cjs), check icon on success, no error icon, no announcement. |
| Logs, debug.log Copy | src/renderer/components/logs-panel.jsx, copyDebugLog in src/renderer/hooks/use-site-logs.jsx |
Outline button, no icon. Renamed the same way as the patch's. |
| Pull request, Copy the link | src/renderer/components/pull-request-destination.jsx, copyLink in src/renderer/hooks/use-pull-request.jsx |
Outline button. Renamed to "Link copied" with a check icon. A failure is silent, and a second copy doesn't restart the timer. |
| GitHub sign-in, Copy the code | same files, copyDeviceCode |
Same as the link. |
| Xdebug setup dialog, Copy launch.json and the PhpStorm Copy buttons | src/renderer/components/xdebug-setup-dialog.jsx (#724) |
Follows the pattern, except it copies with navigator.clipboard (through copyXdebugConfig in src/renderer/index.jsx), not useCopyToClipboard. |
The onError catch
onError was added in @wordpress/compose 9. The app has 8.9.0, through @wordpress/components 41. Adding compose 9 directly pulls in 36 packages, changes 10, and leaves three versions of @wordpress/element in the bundle. So this probably waits for @wordpress/components to move to compose 9, or does everything else first and moves to useCopyToClipboard then.
Proposal
- One shared copy button that follows the pattern, used by every standalone copy control above.
- Remove
copyButtonLabelonce nothing uses it. - Update the journeys that check for the "Copied" name:
logs.spec.js,review-changes.spec.js,site-header.spec.js.
- Ngôn ngữ chính
- JavaScript
- Star
- 66
- Fork
- 20
- Merge trung bình
- 1 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 22
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của WordPress/contributor-toolkit
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
WordPress/contributor-toolkit#762 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
WordPress/contributor-toolkit#747 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
WordPress/contributor-toolkit#746 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
WordPress/contributor-toolkit#741 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
WordPress/contributor-toolkit#726 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của WordPress/contributor-toolkit
Issue tương tự
-
from-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
andromarces/agent-loops#1928 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
laaielichter/AgentHaven#79 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/playwright#44109 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Intl spec updatesĐang mởContent:JS goal: up-to-date needs BCD update
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày