Skip to content
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

Remove usage of inline styles & inline scripts #305

Open
lb- opened this issue Nov 8, 2024 · 4 comments
Open

Remove usage of inline styles & inline scripts #305

lb- opened this issue Nov 8, 2024 · 4 comments

Comments

@lb-
Copy link
Member

lb- commented Nov 8, 2024

It would good to remove our usage of inline styles and move these to the CSS or find a better way to achieve the same result.

This would allow projects to enable CSP for their docs if they want. It also aligns with the direction of Wagtail core - wagtail/wagtail#1288

theme files

<label style="">Search for extensions by key:</label>

<div style="padding: 6px">

domainindex.html

I'm not sure what this file is for but maybe we need to check if we can change it or if it's used.

Note. We should really provide a better alt here also or just use alt="" if it's presentation only.

id="toggle-{{ groupid.next() }}" style="display: none" alt="-" />

Find a way to avoid inline scripts here. Maybe by setting this global in an existing JS file we already load.

<script>
DOCUMENTATION_OPTIONS.COLLAPSE_INDEX = true;
</script>

Originally posted by @ayaan-qadri in #304 (comment)

@lb- lb- changed the title Remove usage of inline styles Remove usage of inline styles & inline scripts Nov 8, 2024
@ayaan-qadri
Copy link
Contributor

I will work on this, I was planning to resolve it within that PR, but it would be messed up, I will raise different PR for this.

@ayaan-qadri
Copy link
Contributor

@lb- I dig bit and found many times inline css is being used in wagtail:

https://github.com/search?q=repo%3Awagtail%2Fwagtail+%22style%22+language%3AHTML&type=code&p=1

If they are necessary to clean up for CSP, I would like to remove them all with proper test if the changes are not breaking anything (it will take long time).

@ayaan-qadri
Copy link
Contributor

I'm not sure about the changes in domainindex.html, and the thing is that I could not find anywhere that it is being used.

@lb-
Copy link
Member Author

lb- commented Nov 10, 2024

@ayaan-qadri there's already a Wagtail (core) issue to cover CSP items, feel free to do an assessment / suggestion for changes on those issues. wagtail/wagtail#1288 & wagtail/wagtail#7053

As for this issue (the one in the Sphinx Wagtail theme), maybe let's just get a PR up that updates other usage and ignores the domainindex.html file for now.

Note that this work is low priority but smaller / focused PRs are welcome in this repo or the Wagtail one if you want to support these efforts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants