RFR: JDK-8276768: Snippet copy feature should use button instead of link
Pavel Rappo
prappo at openjdk.java.net
Mon Nov 8 11:30:33 UTC 2021
On Fri, 5 Nov 2021 19:58:03 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:
> 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
Changes requested by prappo (Reviewer).
This looks good to me. (Sorry, I couldn't seem to quickly undo the "Request Changes" resolution, which I clicked by mistake.)
test/langtools/jdk/javadoc/doclet/testSnippetTag/TestSnippetTag.java line 227:
> 225: <div class="block">A method.
> 226: \s
> 227: <div class="snippet-container"><button class="snippet-copy" onclick="copySni\
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.
[^1]: https://github.com/openjdk/jdk/pull/6011#discussion_r732034367
test/langtools/jdk/javadoc/lib/javadoc/tester/LinkChecker.java line 354:
> 352: void addReference(String name, Path from, int line) {
> 353: if (checked) {
> 354: if (name != null) {
Good to see the checks are back! (https://github.com/openjdk/jdk/pull/6011#discussion_r732039878)
-------------
PR: https://git.openjdk.java.net/jdk/pull/6284Marked as reviewed by prappo (Reviewer).
More information about the javadoc-dev
mailing list