RFR: JDK-8305958: Use links instead of buttons for auto-generated header links
Hannes Wallnöfer
hannesw at openjdk.org
Mon May 8 13:53:28 UTC 2023
On Fri, 5 May 2023 17:47:38 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:
>> Please review a change to use plain HTML links instead of buttons to provide the URL to page section/heading anchors. Special care was taken to retain the accessibility features added in JDK-8299718, so section links can be reached and activated by keyboard and have an `aria-label` attribute. The generated documentation was tested on a range of desktop and mobile browsers (Firefox, Chrome on Mac OS and Linux, Safari on Mac OS and iOS, Chrome on Android) and can be viewed here:
>>
>> https://cr.openjdk.org/~hannesw/8305958/api.00/index.html
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js.template line 417:
>
>> 415: hdr.append(" <a href='#" + id + "' class='anchor-link' aria-label='" + messages.linkToSection
>> 416: + "'><img src='" + pathtoroot + "link.svg' alt='" + messages.linkIcon +"' tabindex='0'"
>> 417: + " style='width: 0.9em; height: 0.9em; vertical-align: baseline;'></a>");
>
> Should this be in a CSS class, not an inline `style` ?
I used inline style to make sure the styles are always available, as the default size of the SVG image is so large that it blows up the layout of the page. My initial choice was to use the `height` and `width` attributes in the HTML `img` element, but after some research came to the conclusion that that was not the proper use of these attributes. (I'm not 100% sure this is the correct conclusion but that's another problem.)
This is how I ended up with the inline styles. It could probably be moved to the stylesheet, at the risk of blowing up the layout when the page is loaded without stylesheet for some reason (such as network problems).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13831#discussion_r1187472516
More information about the javadoc-dev
mailing list