On Thu, 26 Mar 2026 10:41:15 GMT, Shruthi Acharya <[email protected]> wrote:

>> Addressed the Skip navigation links issue in API docs
>> The bug report for the same: https://bugs.openjdk.org/browse/JDK-8368445
>
> Shruthi Acharya has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Adding skip-nav id to main elelement
>   
>   Signed-off-by: Shruthi <[email protected]>

It works as expected if an empty `<span>` with the target id is added as first 
element to the `<main>` element. I don't fully understand the reason why, but I 
suggest using this solution.


--- 
a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/BodyContents.java
+++ 
b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/BodyContents.java
@@ -102,7 +102,9 @@ private Content toContent() {
                 .add(header)
                 .add(HtmlTree.DIV(HtmlStyles.mainGrid)
                         .add(side == null ? Text.EMPTY : side)
-                        
.add(HtmlTree.MAIN().setId(HtmlId.of("skip-navbar-top"))
+                        .add(HtmlTree.MAIN()
+                                .add(HtmlTree.SPAN(Text.EMPTY)
+                                        .setId(HtmlId.of("skip-navbar-top")))
                                 .add(mainContents)
                                 .add(footer == null ? Text.EMPTY : footer)));
     }

-------------

PR Comment: https://git.openjdk.org/jdk/pull/30068#issuecomment-4163086318

Reply via email to