New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve visual accessibility of HTML report #1355
Comments
Hi @aSemy, thanks for the input! Looks like you bring some expertise here. Would you be able to help us to address these issues? |
I'm very flattered because I have no expertise! I'm a very strident backender! :) I would be very happy to set up the pull requests though, but I'd like for someone else to pick the colours. |
Exactly my problem 🤣 So I propose we keep this open until someone with a UI background can help out. |
There are some preparation steps before then: upgrade prettify.js and refactor the existing style to use CSS vars. Once that's done, it becomes much more easy to set the style for a specific theme on a case-by-case basis. |
The migration to highlight.js itself is simple but brings it own problems. Currently, the HTML for the source view mixes line numbers, code coverage and source code. This is fine in prettify.js but discouraged in hightlight.js: This image shows highlight.js (left) and the current view with prettify.js (right). With highlight.js, neither the line numbers nor the coverage data is visible because its HTML is removed, see https://github.com/highlightjs/highlight.js/wiki/security:
A solution to this problem might be to change the appearance to something like IntelliJ's approach and show the coverage indicator in the gutter: |
One potential approach to step away from the How it looks from a GitHub web POV: How the line numbers work from a CSS standpoint: Spans are currently baked in a HTMLElement construct at the moment, but there's nobody saying that things can be changed up, such that they're no longer used. |
@huangsam Thanks for demonstrating how the line numbers can be extracted from the source. But we still have the tags for coverage highlighting, or is there a similar approach to this? |
Yeah then what happens is that we might use non-pre based code lines so that each line is more customized. Imagine an array of |
Another idea: There is some JavaScript code to apply the syntax highlighting. Can't the same code apply coverage highlighting of we provide coverage info e.g. as JSON? |
The original JS code might need to be adjusted if we want to approach things from a div-based approach. I assume it currently applies changes in the But the idea of having a JSON asset seems to make sense. Although that implies local file access from the browser or a light webserver or an in-memory data structure auto generated in the HTML file itself |
Scenario
Current Behaviour
The JaCoCo HTML report has a static style that does not respect my display preferences. This makes it difficult to use and see the results.
Wanted Behaviour
The JaCoCo HTML report is more accessible so it is easier to read and understand the results.
I would like the HTML report to take advantage of modern CSS features to adjust the visual display based on my preferences.
For example, if I prefer a dark theme, then JaCoCo will show a dark theme. If I prefer high-contrast, then JaCoCo will use a theme with high contrast.
I would like this theme committed to the repository so more experienced people can contribute and make sure that the themes are the best they can be.
Here's a quick demo of
prefers-color-scheme: dark
And of high contrast
prefers-contrast: high
Possible Workarounds
In each project run some sort of script that will overwrite the JaCoCo default css and prettify.js?
Proposed tasks
Related issues
Further reading
The text was updated successfully, but these errors were encountered: