-
Notifications
You must be signed in to change notification settings - Fork 198
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
Add course theme variation body class #7225
Conversation
Codecov Report
@@ Coverage Diff @@
## trunk #7225 +/- ##
============================================
- Coverage 50.43% 50.42% -0.02%
- Complexity 10909 10913 +4
============================================
Files 605 605
Lines 45986 46000 +14
Branches 402 402
============================================
Hits 23194 23194
- Misses 22465 22479 +14
Partials 327 327
Continue to review full report in Codecov by Sentry.
|
This is a clever solution, though I spotted a couple of issues:
The discovery of #1 makes me more than a little nervous. 😅 It makes me wonder if they would need to go to the site editor to save the correct variation, which would be a non-starter. Which then made me wonder if there are other situations we haven't thought to test where the incorrect CSS class, or no CSS class, is added. Which then made me wonder if it's safer to just keep doing what we're doing until Gutenberg itself provides a solution. The CSS may be ugly in |
…ithub.com/Automattic/sensei into add/body-class-for-course-theme-variation
Hi @donnapep 👋 Thanks so much for going through it, taking a deep look and sharing your thoughts.
True, this is a valid case. Actually, this holds true for any time we add or change anything in any variation and release a new theme version. For example, when we have new style updates for learning mode for different variations, or button styles, or recently when we added styles for quizzes and questions, if the existing variation users don't go to the site editor and re-save the styles, they won't get the variation style updates. So I think there are the following scenarios to consider -
There is another factor I think, if the user doesn't re-save, the default class is added to body. So is there a risk of imposing default variation's style on the sub variation? I think the answer to the above is there isn't any added problem by it, because, if the user does not re-save, even though the Just sharing my thoughts here, but I may have missed some scenarios. I think, just to be safe, even though hopefully there aren't any very apparent issues much different than the current behavior, we can just add the body class codes, but not remove the styles just yet and wait for a later time to do that, a bit like how we removed learning mode styles from the theme after some time. Also, as an added benefit, I think if we become able to use variation body class for targeting styles, we won't have to worry about the re-saving anymore as we currently do with
Very good observation, it is a valid case. I've added a bit of additional check f45eebc for this, do you think this will do? Another thing I've noticed is this is how we load all our theme specific styles (Astra, Divi, Course). Should we try to add extra checks for them as well? Or should we keep them as they are considering (if) we didn't get much report of issues caused by them and consider this and edge case? Because if template path is changed, users probably will not only have the variation style, rather they may have no different learning mode style for Course theme as well. Also, I'm thinking if we decide to add this code, should we add it in the Course theme directly instead of Sensei. Because Course theme is general purpose. So for example, if we want to add styles to some common blocks (like Post Title, etc), we'd want them to stay in Course theme's repo.
Hahah 😄 True, I've thought so too a bit. I'm absolutely okay with not merging this PR, I just wanted to share the new approach and do some thinking together. As we've discussed above, the |
Thanks for the detailed explanation! ❤️ I don't know why I didn't clue into this, since I know that I have to resave in the editor every time I introduce a change to a variation, but I guess sometimes I'm just on auto-pilot. 🤣 This seems like such a big issue that I'm surprised they haven't fixed it yet. I guess the best we can do is ask them to resave the variation if we get complaints about it. Though I suspect people would be more likely to uninstall the theme instead. Maybe we should consider adding a message to the change log every time we update a variation?
Yup, I fully agree with this and was going to suggest exactly that if we ended up merging.
I'll do a bit more testing and let you know, though it looks like a more reliable check now. 🙂
Yup, noticed that as well. I think we should add the additional check, but probably better to do so in a separate PR to keep this one clean, or just create a new issue.
I don't quite follow this bit. The CSS we're loading there is for Learning Mode, which is part of Sensei, so for me it doesn't make sense to put it in Course. There is still a bit of feedback that I don't believe has been addressed - #7225 (review) and #7225 (review). |
Thanks so much for for going through the PR again. I've addressed the remaining comments too
Thanks, I'll create a new issue for it.
Sorry I didn't explain it better, it's just a thought I wanted to share, nothing I'm too sure about or inclined to. Variation-specific CSS styles can need to be written for any block, for the core blocks too. The course theme can be used without Sensei too. For example, let's say we have to write some CSS which is different for every variation of the Course theme for the Query Loop block. So if the course theme itself adds the body class (we move the |
This sounds like a good idea. Let's do it! 👍🏻 When making the changes, could we shorten the class names to just
When we get there, I think it would be better to have the CSS for each variation in its own CSS file(s) that would be conditionally loaded, so that we're not loading CSS that is never going to be used. |
Moved the functionality to Automattic/themes#7432. So closing this. Relevant issue created here #7248 |
Proposed Changes
Testing Instructions
course-theme-variation-
[default/blue/gold/dark]Pre-Merge Checklist