RFR: 8339541: CSS rule is not specific enough
Jonathan Gibbons
jjg at openjdk.org
Mon Sep 23 19:52:35 UTC 2024
On Tue, 10 Sep 2024 11:24:26 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:
> Please review a CSS fix for javadoc-generated API documentation to avoid a CSS being applied to elements it is not meant for. The rule in question was in JDK-8308659 when we added scrollable container `div` elements. Since elements with non-visible `overflow` prevent [margin collapse](https://www.joshwcomeau.com/css/rules-of-margin-collapse/), this changed the effective margin between some elements, namely between the element descriptions on module, package, and class pages and the subsequent lists/tables.
>
> The problem with the original version of this rule was that it was too generic, and therefore applied to various element within the element description, such as the last items in nessted lists, preview notices, and code snippets. The reason it was kept generic was that the order of the `section` element and the scrollable `div` element is different in module/package pages and class pages.
>
> The new version of the rule uses distinct selectors for module and package pages (the first two rules) and class pages (the second two rules), allowing us to use the child combinator (`>`) to only select direct descendents of the description containers.
>
> I also added a comment to explain the purpose of the rule. The fix was tested on Chrome, Firefox and Safari on macOS and Linux.
Marked as reviewed by jjg (Reviewer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/20933#pullrequestreview-2323175118
More information about the javadoc-dev
mailing list