Skip to content
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

JDK-8276768: Snippet copy feature should use button instead of link #6284

Closed
wants to merge 1 commit into from

Conversation

hns
Copy link
Member

@hns hns commented Nov 5, 2021

This change reimplements the snippet copy-to-clipboard feature using a single <button> element instead of a <a href="#"> with an attached ::before pseudo-element.

While the implementation is more straightforward than before both appearance and functionality should be unchanged. The only (intentional) change is that the new button has a bit more clickable area (i.e. padding) than the old link, but this is offset by the button's positioning so the location of the image and text does not change.

A sample page rendered with the new code containing a few snippets is available here:
http://cr.openjdk.java.net/~hannesw/8276768/api.00/Test.html


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8276768: Snippet copy feature should use button instead of link

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/6284/head:pull/6284
$ git checkout pull/6284

Update a local copy of the PR:
$ git checkout pull/6284
$ git pull https://git.openjdk.java.net/jdk pull/6284/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6284

View PR using the GUI difftool:
$ git pr show -t 6284

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/6284.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Nov 5, 2021

👋 Welcome back hannesw! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr label Nov 5, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 5, 2021

@hns The following label will be automatically applied to this pull request:

  • javadoc

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the javadoc label Nov 5, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Nov 5, 2021

Webrevs

<div class="snippet-container"><a href="#" class="snippet-copy" onclick="cop\
ySnippet(this)" aria-label="Copy" data-copied="Copied!"><img src="../copy.sv\
g" alt="Copy"></a>
<div class="snippet-container"><button class="snippet-copy" onclick="copySni\
Copy link
Member

@pavelrappo pavelrappo Nov 8, 2021

Choose a reason for hiding this comment

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

I'm sorry to see that you had to update snippet HTML in multiple places again. Earlier I said that I was going to improve it 1 and I've already encapsulated the HTML representation of a snippet in the context of not-yet-integrated JDK-8273544. So hopefully, next time you'll need to update snippet HTML, you'll have to do it in one place only.

Footnotes

  1. #6011 (comment)

@@ -351,7 +351,7 @@ void addID(int line, String name) {

void addReference(String name, Path from, int line) {
if (checked) {
if (name != null && !name.isEmpty()) {
if (name != null) {
Copy link
Member

@pavelrappo pavelrappo Nov 8, 2021

Choose a reason for hiding this comment

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

Good to see the checks are back! (#6011 (comment))

Copy link
Member

@pavelrappo pavelrappo left a comment

This looks good to me. (Sorry, I couldn't seem to quickly undo the "Request Changes" resolution, which I clicked by mistake.)

@openjdk
Copy link

@openjdk openjdk bot commented Nov 8, 2021

@hns This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8276768: Snippet copy feature should use button instead of link

Reviewed-by: prappo

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 11 new commits pushed to the master branch:

  • d8b0dee: 8276239: Better tables in java.util.random package summary
  • fc0fe25: 8273235: tools/launcher/HelpFlagsTest.java Fails on Windows 32bit
  • 3934fe5: 8275847: Scheduling fails with "too many D-U pinch points" on small method
  • 44047f8: 8274328: C2: Redundant CFG edges fixup in block ordering
  • 8849154: 8275846: read_base_archive_name() could read past the end of buffer
  • 2653cfb: 8276688: Remove JLinkReproducibleXXXTest from ProblemList.txt
  • c7095b2: 8276207: Properties.loadFromXML/storeToXML works incorrectly for supplementary characters
  • ed7ecca: 8254739: G1: Optimize evacuation failure for regions with few failed objects
  • 59c3dcc: 8276746: Add section on reproducible builds in building.md
  • 0e0dd33: 8276129: PretouchTask should page-align the chunk size
  • ... and 1 more: https://git.openjdk.java.net/jdk/compare/b01f1073f9691c40fc15b7ed67ae2e019ff729ea...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Nov 8, 2021
@hns
Copy link
Member Author

@hns hns commented Nov 8, 2021

/integrate

@openjdk
Copy link

@openjdk openjdk bot commented Nov 8, 2021

Going to push as commit 0395e4e.
Since your change was applied there have been 11 commits pushed to the master branch:

  • d8b0dee: 8276239: Better tables in java.util.random package summary
  • fc0fe25: 8273235: tools/launcher/HelpFlagsTest.java Fails on Windows 32bit
  • 3934fe5: 8275847: Scheduling fails with "too many D-U pinch points" on small method
  • 44047f8: 8274328: C2: Redundant CFG edges fixup in block ordering
  • 8849154: 8275846: read_base_archive_name() could read past the end of buffer
  • 2653cfb: 8276688: Remove JLinkReproducibleXXXTest from ProblemList.txt
  • c7095b2: 8276207: Properties.loadFromXML/storeToXML works incorrectly for supplementary characters
  • ed7ecca: 8254739: G1: Optimize evacuation failure for regions with few failed objects
  • 59c3dcc: 8276746: Add section on reproducible builds in building.md
  • 0e0dd33: 8276129: PretouchTask should page-align the chunk size
  • ... and 1 more: https://git.openjdk.java.net/jdk/compare/b01f1073f9691c40fc15b7ed67ae2e019ff729ea...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 8, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Nov 8, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Nov 8, 2021

@hns Pushed as commit 0395e4e.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated javadoc
2 participants