RFR: JDK-8288671: Problematic fix for font boosting

Jonathan Gibbons jjg at openjdk.org
Mon Jun 20 19:49:44 UTC 2022


On Mon, 20 Jun 2022 17:46:34 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

> Please review an important CSS-only fix for the output generated by JavaDoc. 
> 
> Various mobile browsers have a feature called "font boosting" or "text inflation" to selectively increase the font size of parts of the page to make them easier to read. Since javadoc-generated pages have a `<meta name="viewport" content="width=device-width, initial-scale=1">` declaration that is not really needed, but especially Chrome on Android is very stubborn and insists on changing font sizes in an unpredictable way. 
> 
> It seems like the only way to prevent Chrome/Android from doing this is to include a `min-height` CSS property. In JDK-8277420 we therefore included the CSS declaration shown below to avoid headers from changing font size when the copy-to-clipboard button is shown:
> 
> 
> /* Disable font boosting */
> h1, h2, h3, h4, h5, h6 {
>     max-height: 2em;
> } 
> 
> 
> The idea was that a max-height of `2em` would be enough for how headers are displayed in our docs, but of course I didn't consider wrapped headers. In fact, the main header of the index page is often wrapped twice on small browsers/devices, resulting in the header overlapping with the first paragraph:
> 
> ![Screenshot_20220620-171055~2](https://urldefense.com/v3/__https://user-images.githubusercontent.com/15975/174652966-c7815d9f-1b2f-407c-b241-f11c91e0eca6.png__;!!ACWV5N9M2RV99hQ!OP1yqzrpGUiwLNBeDy9Y5hX25Tn3GB6WhjX5_6PTuRBj0ufk8aAun3oK3nYZKdwYSZcj9uyS_zR8cgE_JA$ )
> 
> Font boosting also occurs in member signatures where some parts are displayed with bigger fonts than others. This is less obvious than the other cases, but it should also be fixed:
> 
> ![Screenshot_20220620-104706~2](https://urldefense.com/v3/__https://user-images.githubusercontent.com/15975/174653488-c22f30c8-086f-4533-86f0-43100dee155d.png__;!!ACWV5N9M2RV99hQ!OP1yqzrpGUiwLNBeDy9Y5hX25Tn3GB6WhjX5_6PTuRBj0ufk8aAun3oK3nYZKdwYSZcj9uyS_zSJ2yN59A$ )
> 
> The proposed fix is to use a very high `max-height` value that is far beyond actual height values, and to include member signatures in the CSS selector.
> 
> This fixes the problems in the screenshots above in Chrome/Android as shown in the screenshots below. It does not have any effects in other browsers.
>  
> ![Screenshot_20220620-171105~2](https://urldefense.com/v3/__https://user-images.githubusercontent.com/15975/174655060-19575a49-2b2c-40cd-ad36-f181f275b2bb.png__;!!ACWV5N9M2RV99hQ!OP1yqzrpGUiwLNBeDy9Y5hX25Tn3GB6WhjX5_6PTuRBj0ufk8aAun3oK3nYZKdwYSZcj9uyS_zT9qLu1zA$ )
> Fixed index page
> 
> ![Screenshot_20220620-104658~2](https://urldefense.com/v3/__https://user-images.githubusercontent.com/15975/174655086-5c18dbf6-bd82-43be-bb07-b187f2b89c82.png__;!!ACWV5N9M2RV99hQ!OP1yqzrpGUiwLNBeDy9Y5hX25Tn3GB6WhjX5_6PTuRBj0ufk8aAun3oK3nYZKdwYSZcj9uyS_zSihEBFkA$ )
> Fixed member signature

Marked as reviewed by jjg (Reviewer).

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

PR: https://git.openjdk.org/jdk19/pull/48


More information about the javadoc-dev mailing list