-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change location of copy to clipboard button #8465
Conversation
Thanks for the PR. @filiprejmus would you mind taking a screenshot of the new location, so we can expedite the review? I know we've had several requests to move it around, and honestly not sure which is best. |
Hi everybody, To get a guidance how to solve this problem properly, we can look into Material Design Specification. Specifically looking at Angular reference implementation of Material Design, we can learn what is the most appropriate placing of icons in
I would suggest the icons on our expandable Operation component will have following placing:
|
@romanblanco if you agree with the suggestion, please redo the PR according to Material Design spec. If you do not agree, let's discuss further. |
@char0n so you suggest to switch chevron and lock? |
diff --git a/src/core/components/operation-summary.jsx b/src/core/components/operation-summary.jsx
index fd61c0d2..702ceb04 100644
--- a/src/core/components/operation-summary.jsx
+++ b/src/core/components/operation-summary.jsx
@@ -80,8 +80,8 @@ export default class OperationSummary extends PureComponent {
</div>
}
- {displayOperationId && (originalOperationId || operationId) ? <span className="opblock-summary-operation-id">{originalOperationId || operationId}</span> : null}
<CopyToClipboardBtn textToCopy={`${specPath.get(1)}`} />
+ {displayOperationId && (originalOperationId || operationId) ? <span className="opblock-summary-operation-id">{originalOperationId || operationId}</span> : null}
<svg className="arrow" width="20" height="20" aria-hidden="true" focusable="false">
<use href={isShown ? "#large-arrow-up" : "#large-arrow-down"} xlinkHref={isShown ? "#large-arrow-up" : "#large-arrow-down"} />
</svg> |
Hi @filiprejmus, Yes I would suggest that, given it's a Material Design recommendation and will allow us to extend the PS: Sorry I confused the ownership of this PR and asked @romanblanco to redo the PR, but you're the author obviously. |
@char0n Sounds good, seems way more natural now that I think about it. I will push it sometime next week! |
Yeah I agree, Material Design was created by learning from natural human interaction patterns. They did a great job in Google on it. |
@char0n changing the location of the lock is a bit more tricky. So right now we have the lock on the very right that opens a modal on click and everything on the left of it which collapses/uncollapses the expanded view on click. Now moving the lock in the middle would mess with this clear separation. On the other hand it doesn't make sense that clicking the copy to clipboard button also uncollapses the operation component. My suggestion would be to only collapse/uncollapse when clicking on the chevron but since that behaviour has been around since the beginning of Swagger UI, I feel it could confuse a lot of users. Another Option could be to collapse when clicking anywhere but the lock and the copy button. Honestly I feel like we should go with that. Do you have any other idea how to proceed with this? |
Here my new suggestion with the last commit! Unfortunately I had to remove the black outline that appears on focus for the moment as the shifting around made it complicated to keep. Thoughts on this look? @char0n |
@char0n ping since there was no follow up in a minute |
@char0n ping :) don't want this to die |
Someone, please approve this PR!!!! |
@filiprejmus sorry for delays. Looking at this now again. |
@filiprejmus I would agree with the visual representation. But what we lost is a keyboard navigation indicator. The "black outline that appears on focus" was very important as it focused the entire operation row and it was clear we could press enter to expand it, when focused. Before swagger-ui-before-keybord-navigation.mp4After swagger-ui-after-keyword-navigation.mp4In the |
@filiprejmus I've issued #9111 which supersedes this PR. PR contains explanation and video how the keyboard navigation and elements now behave. Let me know what you think. |
Closing in favor of #9111. Thank you very much @filiprejmus for pushing this forward. |
Change the location of the copy to clipboard button
Description
This PR moves the copy to clipboard button to a location where it doesn't cause other elements to move in the operation summary bar. It addresses this issue and is providing the exact same change as this PR which unfortunately seems to be abandoned.
Credit to @almirus
Motivation and Context
Fixes #8153 and #8131
How Has This Been Tested?
I built and ran the changed code locally and confirmed that the button now has improved behaviour.
Checklist
My PR contains...
src/
is unmodified: changes to documentation, CI, metadata, etc.)package.json
)My changes...
Documentation
Automated tests