From duke at openjdk.org Mon Nov 3 08:47:08 2025 From: duke at openjdk.org (Jonathan =?UTF-8?B?TGFtcMOpcnRo?=) Date: Mon, 3 Nov 2025 08:47:08 GMT Subject: RFR: 8370612: Simplify implementation of dark theme In-Reply-To: References: Message-ID: On Fri, 31 Oct 2025 13:30:06 GMT, Hannes Walln?fer wrote: > Please review a change to simplify the implementation of CSS themes by solely relying on an attribute set by script instead of the dual script plus media queries approach. This allows us to get rid of duplicate declaration of CSS theme variables. On the downside, JavaScript must be enabled to recognize the system theme, but this is an acceptable compromise as documentation remains fully usable with JavaScript disabled. This change also makes it much easier for users to override or extend JavaDoc stylesheets. > > Also included is a fix for the keyboard tab order of the theme switcher. When opening the theme switcher and hitting the tab key, focus now goes to the theme switcher and no longer goes to the first link in the breadcrumb navigation if there is one. This required moving the HTML for the theme switcher next to the theme button, which required a whole series of test changes. I considered removing the theme switcher markup from these tests, but decided against it, mostly to make sure there are no other unchecked links in the navigation bar. This fix also required reducing the `z-index` of the mobile table of contents. > > Another improvement related to focus handling is to close the theme switcher when it loses focus, and when the `Enter` or `Escape` keys are pressed. Also included is a small change to slightly reduce the padding of the recently introduced TOC sort button. > > Sample documentation [can be viewed here](https://cr.openjdk.org/~hannesw/8370612/api.00/java.base/module-summary.html). Changes look good, thanks! With this it is now more feasible to share dark/light mode icons via themed variables like `--x-svg` (instead of `--x-svg-dark`). This would let us drop some scattered CSS blocks and keep light/dark logic centralized.
Such blocks could be removed :root[data-theme="theme-dark"] input#reset-search, :root[data-theme="theme-dark"] input.reset-filter, :root[data-theme="theme-dark"] input#page-search-reset { background-image: var(--x-svg-dark); }
I would envision something like this :root { --x-svg: url('x.svg'); } :root[data-theme="theme-dark"] { --x-svg: url('data:image/svg+xml; utf8, '); }
What do you think? ------------- PR Comment: https://git.openjdk.org/jdk/pull/28085#issuecomment-3479454752 From hannesw at openjdk.org Mon Nov 3 09:06:05 2025 From: hannesw at openjdk.org (Hannes =?UTF-8?B?V2FsbG7DtmZlcg==?=) Date: Mon, 3 Nov 2025 09:06:05 GMT Subject: RFR: 8370612: Simplify implementation of dark theme In-Reply-To: <4yZU1a4FFqS0EVPO8TLeisXaxv722Tb40LupDQ2tBuw=.56e52a93-17dc-4b4c-afe7-4c2a2a968576@github.com> References: <4yZU1a4FFqS0EVPO8TLeisXaxv722Tb40LupDQ2tBuw=.56e52a93-17dc-4b4c-afe7-4c2a2a968576@github.com> Message-ID: On Fri, 31 Oct 2025 22:48:45 GMT, Chen Liang wrote: > What is the purpose of the padding change? I see the padding is now narrower, but the bar is still thicker than in 25. The button was just a bit large, both compared to nearby elements such as the filter input, and to other buttons in the UI such as the theme picker or copy-to-clipboard button. Now it's the same size as the other buttons (32 x 32 px). (Image button size is content + 2 * padding, so padding has to be adjusted to the image.) Using `px` as unit is also a bit more consistent with other buttons. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28085#issuecomment-3479537630 From hannesw at openjdk.org Mon Nov 3 10:45:43 2025 From: hannesw at openjdk.org (Hannes =?UTF-8?B?V2FsbG7DtmZlcg==?=) Date: Mon, 3 Nov 2025 10:45:43 GMT Subject: RFR: 8370612: Simplify implementation of dark theme [v2] In-Reply-To: References: Message-ID: <4n3NZogRiZPiJcU0KIrYlTur3OyQ4F1VbuNQWLVzr-I=.7872e63c-96ad-41ac-8ed4-f0180bc001f6@github.com> > Please review a change to simplify the implementation of CSS themes by solely relying on an attribute set by script instead of the dual script plus media queries approach. This allows us to get rid of duplicate declaration of CSS theme variables. On the downside, JavaScript must be enabled to recognize the system theme, but this is an acceptable compromise as documentation remains fully usable with JavaScript disabled. This change also makes it much easier for users to override or extend JavaDoc stylesheets. > > Also included is a fix for the keyboard tab order of the theme switcher. When opening the theme switcher and hitting the tab key, focus now goes to the theme switcher and no longer goes to the first link in the breadcrumb navigation if there is one. This required moving the HTML for the theme switcher next to the theme button, which required a whole series of test changes. I considered removing the theme switcher markup from these tests, but decided against it, mostly to make sure there are no other unchecked links in the navigation bar. This fix also required reducing the `z-index` of the mobile table of contents. > > Another improvement related to focus handling is to close the theme switcher when it loses focus, and when the `Enter` or `Escape` keys are pressed. Also included is a small change to slightly reduce the padding of the recently introduced TOC sort button. > > Sample documentation [can be viewed here](https://cr.openjdk.org/~hannesw/8370612/api.00/java.base/module-summary.html). Hannes Walln?fer has updated the pull request incrementally with one additional commit since the last revision: Further improve theme styles ------------- Changes: - all: https://git.openjdk.org/jdk/pull/28085/files - new: https://git.openjdk.org/jdk/pull/28085/files/5af88406..919e3ae6 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=28085&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28085&range=00-01 Stats: 69 lines in 2 files changed: 33 ins; 31 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/28085.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/28085/head:pull/28085 PR: https://git.openjdk.org/jdk/pull/28085 From hannesw at openjdk.org Mon Nov 3 11:18:42 2025 From: hannesw at openjdk.org (Hannes =?UTF-8?B?V2FsbG7DtmZlcg==?=) Date: Mon, 3 Nov 2025 11:18:42 GMT Subject: RFR: 8370612: Simplify implementation of dark theme [v3] In-Reply-To: References: Message-ID: > Please review a change to simplify the implementation of CSS themes by solely relying on an attribute set by script instead of the dual script plus media queries approach. This allows us to get rid of duplicate declaration of CSS theme variables. On the downside, JavaScript must be enabled to recognize the system theme, but this is an acceptable compromise as documentation remains fully usable with JavaScript disabled. This change also makes it much easier for users to override or extend JavaDoc stylesheets. > > Also included is a fix for the keyboard tab order of the theme switcher. When opening the theme switcher and hitting the tab key, focus now goes to the theme switcher and no longer goes to the first link in the breadcrumb navigation if there is one. This required moving the HTML for the theme switcher next to the theme button, which required a whole series of test changes. I considered removing the theme switcher markup from these tests, but decided against it, mostly to make sure there are no other unchecked links in the navigation bar. This fix also required reducing the `z-index` of the mobile table of contents. > > Another improvement related to focus handling is to close the theme switcher when it loses focus, and when the `Enter` or `Escape` keys are pressed. Also included is a small change to slightly reduce the padding of the recently introduced TOC sort button. > > Sample documentation [can be viewed here](https://cr.openjdk.org/~hannesw/8370612/api.00/java.base/module-summary.html). Hannes Walln?fer has updated the pull request incrementally with one additional commit since the last revision: More cleanup and better separation of TOC button styles ------------- Changes: - all: https://git.openjdk.org/jdk/pull/28085/files - new: https://git.openjdk.org/jdk/pull/28085/files/919e3ae6..35ee5df0 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=28085&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28085&range=01-02 Stats: 10 lines in 1 file changed: 6 ins; 3 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/28085.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/28085/head:pull/28085 PR: https://git.openjdk.org/jdk/pull/28085 From hannesw at openjdk.org Mon Nov 3 11:33:02 2025 From: hannesw at openjdk.org (Hannes =?UTF-8?B?V2FsbG7DtmZlcg==?=) Date: Mon, 3 Nov 2025 11:33:02 GMT Subject: RFR: 8370612: Simplify implementation of dark theme In-Reply-To: References: Message-ID: On Mon, 3 Nov 2025 08:44:28 GMT, Jonathan Lamp?rth wrote: > With this it is now more feasible to share dark/light mode icons via themed variables like --x-svg (instead of --x-svg-dark). Thanks for the excellent suggestion, I updated the PR. I also made some further tweaks to TOC button styles: - Change hover border color to the one intended for the purpose (`--button-border-color`), which is more visible especially in dark theme - Move the positioning for the hide/show sidebar buttons into a separate ruleset that does not apply to the sort button - Tweak TOC size and position of hide/show buttons so that the hide button doesn't overlap the TOC (which moved down a bit because of the added sort button) I uploaded the stylesheet of the [sample docs](https://cr.openjdk.org/~hannesw/8370612/api.00/java.base/java/lang/Thread.html#setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)) in-place, you may have to shift-reload to fetch the new version of the stylesheet. ------------- PR Comment: https://git.openjdk.org/jdk/pull/28085#issuecomment-3480050871 From duke at openjdk.org Mon Nov 3 12:31:56 2025 From: duke at openjdk.org (Jonathan =?UTF-8?B?TGFtcMOpcnRo?=) Date: Mon, 3 Nov 2025 12:31:56 GMT Subject: RFR: 8370612: Simplify implementation of dark theme [v3] In-Reply-To: References: Message-ID: <4ulSSwdIQrp1s3qerUozzxBGodq2tqc6sKgfFNUgPfU=.e9e401ce-19f7-441b-8aca-e03129be57cf@github.com> On Mon, 3 Nov 2025 11:18:42 GMT, Hannes Walln?fer wrote: >> Please review a change to simplify the implementation of CSS themes by solely relying on an attribute set by script instead of the dual script plus media queries approach. This allows us to get rid of duplicate declaration of CSS theme variables. On the downside, JavaScript must be enabled to recognize the system theme, but this is an acceptable compromise as documentation remains fully usable with JavaScript disabled. This change also makes it much easier for users to override or extend JavaDoc stylesheets. >> >> Also included is a fix for the keyboard tab order of the theme switcher. When opening the theme switcher and hitting the tab key, focus now goes to the theme switcher and no longer goes to the first link in the breadcrumb navigation if there is one. This required moving the HTML for the theme switcher next to the theme button, which required a whole series of test changes. I considered removing the theme switcher markup from these tests, but decided against it, mostly to make sure there are no other unchecked links in the navigation bar. This fix also required reducing the `z-index` of the mobile table of contents. >> >> Another improvement related to focus handling is to close the theme switcher when it loses focus, and when the `Enter` or `Escape` keys are pressed. Also included is a small change to slightly reduce the padding of the recently introduced TOC sort button. >> >> Sample documentation [can be viewed here](https://cr.openjdk.org/~hannesw/8370612/api.00/java.base/module-summary.html). > > Hannes Walln?fer has updated the pull request incrementally with one additional commit since the last revision: > > More cleanup and better separation of TOC button styles Changes look great! I would probably define the following outside of the `:root` blocks, and leave that to be variable definitions only: button#theme-button img.light-theme-icon { display: inline; } button#theme-button img.dark-theme-icon { display: none; } Probably the best solution would be to store `--current-theme-svg=url(moon.svg)`, `--current-theme-svg=url(sun.svg)`and use the `background` property for this button too? ------------- PR Comment: https://git.openjdk.org/jdk/pull/28085#issuecomment-3480282575 From jlahoda at openjdk.org Mon Nov 3 16:19:27 2025 From: jlahoda at openjdk.org (Jan Lahoda) Date: Mon, 3 Nov 2025 16:19:27 GMT Subject: RFR: 8370334: javadoc NPE with "import module" statement [v2] In-Reply-To: References: Message-ID: > `Modules.enter` completes all root modules, but in case of additional modules being added to the module graph via `Modules.addExtraAddModules` (either from javadoc, or using the `CompilationTask.addModules`, these extra modules may not be completed at this time. Normally, they are completed eventually, but if their `module-info`s contain `import module`, an NPE will appear while checking the import, before the complete happens. > > The proposal herein is to consistently complete all modules in the module graph when the module graphs is setup. Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision: Don't eagerly complete the unnamed module. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/27974/files - new: https://git.openjdk.org/jdk/pull/27974/files/ff2162ee..14ac910e Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=27974&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=27974&range=00-01 Stats: 4 lines in 1 file changed: 3 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/27974.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/27974/head:pull/27974 PR: https://git.openjdk.org/jdk/pull/27974 From hannesw at openjdk.org Mon Nov 3 16:45:20 2025 From: hannesw at openjdk.org (Hannes =?UTF-8?B?V2FsbG7DtmZlcg==?=) Date: Mon, 3 Nov 2025 16:45:20 GMT Subject: RFR: 8370612: Simplify implementation of dark theme [v4] In-Reply-To: References: Message-ID: <_3pWKgGiRVWvoM2vtNXS_w2dpkl0YaWZ3_Q0XisgVG4=.0f4edc16-e30e-4e4c-bafd-df6f676c2cda@github.com> > Please review a change to simplify the implementation of CSS themes by solely relying on an attribute set by script instead of the dual script plus media queries approach. This allows us to get rid of duplicate declaration of CSS theme variables. On the downside, JavaScript must be enabled to recognize the system theme, but this is an acceptable compromise as documentation remains fully usable with JavaScript disabled. This change also makes it much easier for users to override or extend JavaDoc stylesheets. > > Also included is a fix for the keyboard tab order of the theme switcher. When opening the theme switcher and hitting the tab key, focus now goes to the theme switcher and no longer goes to the first link in the breadcrumb navigation if there is one. This required moving the HTML for the theme switcher next to the theme button, which required a whole series of test changes. I considered removing the theme switcher markup from these tests, but decided against it, mostly to make sure there are no other unchecked links in the navigation bar. This fix also required reducing the `z-index` of the mobile table of contents. > > Another improvement related to focus handling is to close the theme switcher when it loses focus, and when the `Enter` or `Escape` keys are pressed. Also included is a small change to slightly reduce the padding of the recently introduced TOC sort button. > > Sample documentation [can be viewed here](https://cr.openjdk.org/~hannesw/8370612/api.00/java.base/module-summary.html). Hannes Walln?fer has updated the pull request incrementally with one additional commit since the last revision: Simplify theme button ------------- Changes: - all: https://git.openjdk.org/jdk/pull/28085/files - new: https://git.openjdk.org/jdk/pull/28085/files/35ee5df0..1e832573 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=28085&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=28085&range=02-03 Stats: 95 lines in 6 files changed: 2 ins; 70 del; 23 mod Patch: https://git.openjdk.org/jdk/pull/28085.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/28085/head:pull/28085 PR: https://git.openjdk.org/jdk/pull/28085 From hannesw at openjdk.org Mon Nov 3 16:45:22 2025 From: hannesw at openjdk.org (Hannes =?UTF-8?B?V2FsbG7DtmZlcg==?=) Date: Mon, 3 Nov 2025 16:45:22 GMT Subject: RFR: 8370612: Simplify implementation of dark theme [v3] In-Reply-To: <4ulSSwdIQrp1s3qerUozzxBGodq2tqc6sKgfFNUgPfU=.e9e401ce-19f7-441b-8aca-e03129be57cf@github.com> References: <4ulSSwdIQrp1s3qerUozzxBGodq2tqc6sKgfFNUgPfU=.e9e401ce-19f7-441b-8aca-e03129be57cf@github.com> Message-ID: On Mon, 3 Nov 2025 12:28:49 GMT, Jonathan Lamp?rth wrote: > Probably the best solution would be to store --current-theme-svg=url(moon.svg), --current-theme-svg=url(sun.svg)and use the background property for this button too? D'oh! Thanks! ------------- PR Comment: https://git.openjdk.org/jdk/pull/28085#issuecomment-3481477221 From duke at openjdk.org Mon Nov 3 16:49:05 2025 From: duke at openjdk.org (Jonathan =?UTF-8?B?TGFtcMOpcnRo?=) Date: Mon, 3 Nov 2025 16:49:05 GMT Subject: RFR: 8370612: Simplify implementation of dark theme [v4] In-Reply-To: <_3pWKgGiRVWvoM2vtNXS_w2dpkl0YaWZ3_Q0XisgVG4=.0f4edc16-e30e-4e4c-bafd-df6f676c2cda@github.com> References: <_3pWKgGiRVWvoM2vtNXS_w2dpkl0YaWZ3_Q0XisgVG4=.0f4edc16-e30e-4e4c-bafd-df6f676c2cda@github.com> Message-ID: On Mon, 3 Nov 2025 16:45:20 GMT, Hannes Walln?fer wrote: >> Please review a change to simplify the implementation of CSS themes by solely relying on an attribute set by script instead of the dual script plus media queries approach. This allows us to get rid of duplicate declaration of CSS theme variables. On the downside, JavaScript must be enabled to recognize the system theme, but this is an acceptable compromise as documentation remains fully usable with JavaScript disabled. This change also makes it much easier for users to override or extend JavaDoc stylesheets. >> >> Also included is a fix for the keyboard tab order of the theme switcher. When opening the theme switcher and hitting the tab key, focus now goes to the theme switcher and no longer goes to the first link in the breadcrumb navigation if there is one. This required moving the HTML for the theme switcher next to the theme button, which required a whole series of test changes. I considered removing the theme switcher markup from these tests, but decided against it, mostly to make sure there are no other unchecked links in the navigation bar. This fix also required reducing the `z-index` of the mobile table of contents. >> >> Another improvement related to focus handling is to close the theme switcher when it loses focus, and when the `Enter` or `Escape` keys are pressed. Also included is a small change to slightly reduce the padding of the recently introduced TOC sort button. >> >> Sample documentation [can be viewed here](https://cr.openjdk.org/~hannesw/8370612/api.00/java.base/module-summary.html). > > Hannes Walln?fer has updated the pull request incrementally with one additional commit since the last revision: > > Simplify theme button LGTM! ------------- Marked as reviewed by jonath4ndev at github.com (no known OpenJDK username). PR Review: https://git.openjdk.org/jdk/pull/28085#pullrequestreview-3411959028