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.

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

Commit messages:
 - JDK-8339541: CSS rule is not specific enough

Changes: https://git.openjdk.org/jdk/pull/20933/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20933&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8339541
  Stats: 5 lines in 1 file changed: 3 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/20933.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/20933/head:pull/20933

PR: https://git.openjdk.org/jdk/pull/20933

Reply via email to