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

Fix site logo getting distorted #7275

Merged
merged 6 commits into from
Nov 9, 2023
Merged

Fix site logo getting distorted #7275

merged 6 commits into from
Nov 9, 2023

Conversation

Imran92
Copy link
Contributor

@Imran92 Imran92 commented Nov 8, 2023

Resolves #7271

Proposed Changes

  • Recently we increased the priority (Set the priority of the base learning mode styles to 9 instead of default 10) of the learning mode CSS file so that the theme specific learning mode CSS files can override the base CSS styles without the need to make the styles specify more basic learning mode styles.

The problem was the styles that come from wp core, or Gutenberg or the themes (not referring to the theme specific CSS we have) were still getting loaded with priority 10. So these core/gb/other styles were also overriding our LM styles if the specificity was same.

For example, in this particular instance with site icon, we have a style to set the width of site logo to auto, in core the width for that is 120px. So core style was overriding ours.

We could just remove the priority 9, but that'd have removed the added facility we got, which is overriding base lm styles with theme specific LM styles.

To still have that facility, we removed the 9, but added 11 to the theme specific styles. Now our base LM styles overrides the core styles, and our theme specific styles override the base LM styles.

Also, there was additional call to Course theme's enqueue function from divi's PHP file. We've removed that.

Before increasing priority:
Screenshot 2023-11-07 at 7 50 39 PM

After increasing priority:
Screenshot 2023-11-07 at 7 51 38 PM

Testing Instructions

  1. Install one of those themes Astra, GeneratePress, Storefront
  2. Add site logo in Appearance > Customize > Site Identitiy (add a square logo and skip cropping)
  3. Visit a lesson in the Learning Mode
  4. Make sure the site logo is not distorted.
  5. Now add the following style in main learning-mode.css file
.sensei-course-theme .wp-block-site-logo img {
	max-height: 124px;
	width: 150px;
}
  1. Check in the frontend, make sure the icon has grown to 150px
  2. Now without removing the above style, add the following style in Astra's (assuming you are using Astra) learning-mode.css (assets/css/3rd-party/themes/astra/learning-mode.css)
.sensei-course-theme .wp-block-site-logo img {
	max-height: 124px;
	width: 10px;
}
  1. Make sure the theme specific style is overriding the base LM style
  2. Do not push the CSS changes :p

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@Imran92 Imran92 added this to the 4.19.2 milestone Nov 8, 2023
@Imran92 Imran92 requested a review from a team November 8, 2023 12:48
@Imran92 Imran92 self-assigned this Nov 8, 2023
Copy link

codecov bot commented Nov 8, 2023

Codecov Report

Merging #7275 (081d668) into trunk (8e68ffa) will increase coverage by 0.01%.
Report is 7 commits behind head on trunk.
The diff coverage is 50.00%.

❗ Current head 081d668 differs from pull request most recent head ea74717. Consider uploading reports for the commit ea74717 to get more accurate results

Impacted file tree graph

@@             Coverage Diff              @@
##              trunk    #7275      +/-   ##
============================================
+ Coverage     50.59%   50.60%   +0.01%     
- Complexity    10975    10976       +1     
============================================
  Files           608      608              
  Lines         46286    46286              
  Branches        402      402              
============================================
+ Hits          23417    23422       +5     
+ Misses        22542    22537       -5     
  Partials        327      327              
Files Coverage Δ
...i/class-sensei-rest-api-question-helpers-trait.php 92.78% <100.00%> (+0.80%) ⬆️
...ncludes/course-theme/class-sensei-course-theme.php 18.78% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c7a8423...ea74717. Read the comment docs.

Copy link
Member

@m1r0 m1r0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as described. 👍

@Imran92 Imran92 merged commit 115c144 into trunk Nov 9, 2023
22 checks passed
@Imran92 Imran92 deleted the fix/distorting-site-logo branch November 9, 2023 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Distorted logo in Learning mode heading in some themes (Sensei LMS 4.19.1)
2 participants