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 conflict for logo_height argument by default.xml #30370

Open
wants to merge 3 commits into
base: 2.4-develop
Choose a base branch
from

Conversation

PierW
Copy link
Member

@PierW PierW commented Oct 8, 2020

Description (*)

For a new theme, for example child of luma, if you want change the logo by default.xml and set also his size by the height, you should write this:

<referenceBlock name="logo"> <arguments> <argument name="logo_file" xsi:type="string">images/logo.png</argument> <argument name="logo_height" xsi:type="number">300</argument> </arguments> </referenceBlock>

Now the problem is that it doesn't works, because there is a conflict with the line 151 of _module.less:
Schermata 2020-10-07 alle 19 56 30
Schermata 2020-10-07 alle 19 56 42

The result is that our rule is overwritten:
Schermata 2020-10-07 alle 19 22 14

It doesn't happen with Width.
Sometime we want set the image by height and not by the width... or maybe with both... why not? It's your choice.
So for now the logo_height have no sense to exist.

The height: auto should be deleted and all will work fine.

Related Pull Requests

Fixed Issues (if relevant)

Manual testing scenarios (*)

  1. Magento 2.4-develop

  2. Create a new theme child of Luma

  3. Create the default.xml and copy this:

     <referenceBlock name="logo">
      <arguments>
             <argument name="logo_file" xsi:type="string">images/logo.png</argument>
             <argument name="logo_height" xsi:type="number">300</argument>
       </arguments>
     </referenceBlock>
    
  4. Put your custom logo.png inside the images folder.

  5. Save and delete the cache

  6. Refresh the page

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

Resolved issues:

  1. resolves [Issue] fix conflict for logo_height argument by default.xml #30377: fix conflict for logo_height argument by default.xml

@m2-assistant
Copy link

m2-assistant bot commented Oct 8, 2020

Hi @PierW. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@PierW
Copy link
Member Author

PierW commented Oct 8, 2020

@magento run all tests

@orlangur orlangur self-assigned this Oct 8, 2020
@sidolov sidolov added Priority: P4 No current plan to fix. Fixing can be deferred as a logical part of more important work. Severity: S4 Affects aesthetics, professional look and feel, “quality” or “usability”. labels Oct 8, 2020
@sidolov
Copy link
Contributor

sidolov commented Oct 8, 2020

@magento create issue

@mrtuvn
Copy link
Contributor

mrtuvn commented Oct 8, 2020

@PierW Can you update for blank theme ?
I found same file in blank theme have same declare
see this https://github.com/magento/magento2/blob/2.4-develop/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/_module.less#L94
IMO this declare in theme less file is unneccesary. Default magento already set height auto we don't have to re-declare height for image

@PierW
Copy link
Member Author

PierW commented Oct 8, 2020

@PierW Can you update for blank theme ?
I found same file in blank theme have same declare
see this https://github.com/magento/magento2/blob/2.4-develop/app/design/frontend/Magento/blank/Magento_Theme/web/css/source/_module.less#L94
IMO this declare in theme less file is unneccesary. Default magento already set height auto we don't have to re-declare height for image

@mrtuvn Done, thanks :)

@mrtuvn
Copy link
Contributor

mrtuvn commented Oct 8, 2020

Ok seem everything ok with me
@krzksz can you give this PR some review! Thanks

@PierW
Copy link
Member Author

PierW commented Oct 9, 2020

@magento run all tests

ptylek
ptylek previously approved these changes Oct 12, 2020
Copy link
Contributor

@ptylek ptylek left a comment

Choose a reason for hiding this comment

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

Looks good to me. Broken functional tests seem not related to this PR.

@magento-engcom-team
Copy link
Contributor

Hi @ptylek, thank you for the review.
ENGCOM-8331 has been created to process this Pull Request
✳️ @ptylek, could you please add one of the following labels to the Pull Request?

Label Description
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests
Auto-Tests: Not Covered Changes in Pull Request requires coverage by auto-tests
Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests

@ptylek ptylek added the Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests label Oct 12, 2020
@engcom-Alfa engcom-Alfa self-assigned this Oct 19, 2020
Copy link
Contributor

@engcom-Alfa engcom-Alfa left a comment

Choose a reason for hiding this comment

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

Hi @PierW.
Looks like the changes don't solve the issue.

Manual testing scenario:

  1. Magento 2.4-develop

  2. Create a new theme child of Luma

  3. Create the default.xml and copy this:

     <referenceBlock name="logo">
      <arguments>
             <argument name="logo_file" xsi:type="string">images/logo.png</argument>
             <argument name="logo_height" xsi:type="number">300</argument>
       </arguments>
     </referenceBlock>
    
  4. Put your custom logo.png inside the images folder.

  5. Save and delete the cache

  6. Refresh the page

Actual Result: ✖️ The logo image is still with the same parameters

2020-10-20_14-50

@PierW Maybe we missed something?
Could you take a look?
Thanks!

@ghost ghost dismissed ptylek’s stale review October 20, 2020 12:11

Pull Request state was updated. Re-review required.

@PierW
Copy link
Member Author

PierW commented Oct 21, 2020

images/logo.png 300

@engcom-Alfa Could you try to do that in developer mode? So we will check better why and where do you have the image{ height: auto} in style-m.less, I'm sure, now I tried again. With Luma and Blank theme do you have just:
.logo .img{} selector on line 94 and 151 of _module.less. I checked also on Magento 2.3.5 now.
Schermata 2020-10-21 alle 19 44 11

@PierW
Copy link
Member Author

PierW commented Nov 23, 2020

@engcom-Alfa fixed! It was the line 50 (Height: auto) of _resets.less file on version 2.4 of magento.
Now for me it's ok.

@@ -49,7 +49,6 @@

img {
max-width: 100%;
height: auto;
border: 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove height here may cause image distorted

Copy link
Member Author

@PierW PierW Nov 23, 2020

Choose a reason for hiding this comment

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

So why is there methods 'logo_height' inside the block if we can't use that?
If you don't put that in _resets.less... and you don't set an height, it will be "auto" for default.

Copy link
Contributor

Choose a reason for hiding this comment

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

i'm ok with height auto in file reset. Only need remove redundant code in folder theme when you already have set default in reset file

Copy link
Contributor

@mrtuvn mrtuvn Nov 23, 2020

Choose a reason for hiding this comment

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

I would use both define width height attribute image html and also use height auto in css. Note you also able to set width height of logo in config from backend

@mrtuvn
Copy link
Contributor

mrtuvn commented Nov 23, 2020

#29721
Your PR fix may improve for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Design/Frontend Auto-Tests: Not Required Changes in Pull Request does not require coverage by auto-tests Priority: P4 No current plan to fix. Fixing can be deferred as a logical part of more important work. Progress: review Release Line: 2.4 Severity: S4 Affects aesthetics, professional look and feel, “quality” or “usability”.
Projects
Status: Review in Progress
Development

Successfully merging this pull request may close these issues.

[Issue] fix conflict for logo_height argument by default.xml
7 participants