Integrated: 8339541: CSS rule is not specific enough
Hannes Wallnöfer
hannesw at openjdk.org
Wed Sep 25 12:17:39 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.
This pull request has now been integrated.
Changeset: 120463dc
Author: Hannes Wallnöfer <hannesw at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/120463dc90d717bffb2bd0d5e6b1ea707f5d1b42
Stats: 5 lines in 1 file changed: 3 ins; 0 del; 2 mod
8339541: CSS rule is not specific enough
Reviewed-by: jjg
-------------
PR: https://git.openjdk.org/jdk/pull/20933
More information about the javadoc-dev
mailing list