openedx / openedx/openedx-platform
Replace `xmodule_[display|edit]` with standard XBlock CSS classes
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8.2k
- Forks
- 4.4k
- Avg merge
- 6d 18h
- Merged PRs (30d)
- 42
Description
Background
Every built-in XBlock marked with uses_xmodule_styles_setup = True gets two CSS classes:
xmodule_<display|edit>andxmodule_<display|edit>_<ClassName>.
This adds complexity to the edx-platform XBlock runtime and makes the builtin block CSS messier. Before extracting this CSS to xblocks-contrib, we should turn get rid of these CSS classes and the uses_xmodule_styles_setup option. We should instead use the standard xblock CSS classes:
xblockxblock-{view_name}xblock-{view_name}-{block_tag}
For all display views (author, public, and student), we should add two more new CSS classes to every xblock:
xblock-displayxblock-display-{block_tag}
These two new classes will help us keep the builtin block CSS brief. Otherwise, we'd have to repeat xblock-student_view, xblock-author_view, and xblock-preview_view throughout the CSS file.
Tasks
In the xblock renderer function wrap_xblock, remove the if-clause which adds the xmodule_* classes, and add the two new xblock-display* classes.
In every builtin block CSS file, use find-and-replace to switch from the xmodule_ CSS classes to the xblock- CSS classes. There should be absolutely no visible changes for end users.
Search for use_xmodule_styles_setup, xmodule_edit, and xmodule_display. Ensure that there are no remaining references. Update tests as necessary.
Partial Implementation
This PR takes care of updating the rendered classes. It also updates ProblemBlock's CSS. All the other builtin block CSS files still need fixing.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the xblock renderer function wrap_xblock and review the partial implementation in PR 35834, including ProblemBlock's CSS changes. Search builtin block CSS files and the terms use_xmodule_styles_setup, xmodule_edit, and xmodule_display. Done means all remaining references are replaced, tests are updated as needed, and there are no visible changes for end users.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, python
- Domain
- frontend, web-dev
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100