On Tue, 10 Sep 2024 11:24:26 GMT, Hannes Wallnöfer <hann...@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. I have uploaded [sample docs](https://cr.openjdk.org/~hannesw/8339541/api.00/) built with this fix. Some places where the fix is visible: - Margin beneath the first code snippet [in this page](https://cr.openjdk.org/~hannesw/8339541/api.00/java.base/java/lang/classfile/package-summary.html) (compare [before fix](https://download.java.net/java/early_access/jdk24/docs/api/java.base/java/lang/classfile/package-summary.html)) - Margin beneath text in the preview notice [in this page](https://cr.openjdk.org/~hannesw/8339541/api.00/java.base/java/lang/classfile/AccessFlags.html) (compare [before fix](https://download.java.net/java/early_access/jdk24/docs/api/java.base/java/lang/classfile/AccessFlags.html)) ------------- PR Comment: https://git.openjdk.org/jdk/pull/20933#issuecomment-2349161191