RFR: JDK-8287524: Improve checkboxes to select releases on deprecated API page [v2]

Hannes Wallnöfer hannesw at openjdk.java.net
Fri Jun 3 09:13:31 UTC 2022


On Wed, 1 Jun 2022 18:11:48 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> Hannes Wallnöfer has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add comment
>
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SummaryListWriter.java line 136:
> 
>> 134:         bodyContents.addMainContent(content);
>> 135:         // The script below enables checkboxes in the page and invokes their click handler
>> 136:         // to restore any previous state, which unfortunately doesn't work on all browsers.
> 
> This comment looks worrying.
> It might be worth identifying good or bad browsers, either here or in public-facing documentation.

I was going to reply that the comment I added was actually unfounded as the differences in behaviors in various browsers are just based on different policies/choices (Firefox preserves input field values in page reloads while Safari, Chrome and most other browsers do not). The purpose of the script is to preserve checkbox state and element visibility in forward/back navigation, which actually works in all browsers tested (including mobile browsers on iOS and Android).

However, I noted an odd  case where element visibility was not updated in forward/back navigation in Chrome when the page was viewed locally via `file:` protocol while it worked with the same code via `http` protocol. Obviously this is some kind of race condition. I found a solution by adding a second event handler for the window `load` event which is fired when the page is fully loaded (compared to the document `DOMContentLoaded` event which is fired when the DOM is ready). It now works on Chrome in all configurations I have tested, although there may be a brief flickering of checkbox status and table contents when the page is loaded. However, I think this is the best and safest thing we can do for now.

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

PR: https://git.openjdk.java.net/jdk/pull/8973


More information about the javadoc-dev mailing list