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

[Backport] Update details.phtml #21531

Conversation

amol2jcommerce
Copy link
Contributor

Original Pull Request

#20858
Good afternoon,

I just encountered a problem with product's tabs in product info.
I realized when description or other custom tabs have links, when you click on it, nothing happen.

It caused by the script mage/tabs.js in details.phtml.

The current link to trigger the tab is declared with data-role="switch" instead of a data-role="trigger".

<div class="data item title"
aria-labelledby="tab-label-<?= /* @escapeNotVerified */ $alias ?>-title"
data-role="collapsible" id="tab-label-<?= /* @escapeNotVerified */ $alias ?>">
<a class="data switch"
tabindex="-1"
data-toggle="switch"
href="#<?= /* @escapeNotVerified */ $alias ?>"
id="tab-label-<?= /* @escapeNotVerified */ $alias ?>-title">
<?= /* @escapeNotVerified */ $label ?>
</a>
</div>
<div class="data item content" id="<?= /* @escapeNotVerified */ $alias ?>" data-role="content">
<?= /* @escapeNotVerified */ $html ?>
</div>

When not even the trigger and the header is declared respectively by data-role="heading" and data-role="trigger", the script based it search on the current collapsible panel declared by data-role="collapsible".

/**
* Prepare the elements for instantiating the collapsible widget
* @private
*/
_processPanels: function () {
this.contents = this.element.find(this.options.content);
this.collapsibles = this.element.find(this.options.collapsibleElement);
this.collapsibles
.attr('role', 'presentation')
.parent()
.attr('role', 'tablist');
this.headers = this.element.find(this.options.header);
if (this.headers.length === 0) {
this.headers = this.collapsibles;
}
this.triggers = this.element.find(this.options.trigger);
if (this.triggers.length === 0) {
this.triggers = this.headers;
}
this._callCollapsible();
},

You can simply try by adding a link in the product description.

Tell me if I am wrong.

Cheers,
Ilan PARMENTIER

Good afternoon,

I just encountered a problem with product's tabs in product info.
I realized when description or other custom tabs have links, when you click on it, nothing happen.

It caused by the script mage/tabs.js in details.phtml.

The current link to trigger the tab is declared with data-role="switch" instead of a data-role="trigger".

https://github.com/magento/magento2/blob/4f232511ceba6f1f7bf6f73b3b5609bd087f8c74/app/code/Magento/Catalog/view/frontend/templates/product/view/details.phtml#L24-L37

When not even the trigger and the header is declared respectively by data-role="heading" and data-role="trigger", the script based it search on the current collapsible panel declared by data-role="collapsible".

https://github.com/magento/magento2/blob/4f232511ceba6f1f7bf6f73b3b5609bd087f8c74/lib/web/mage/tabs.js#L99-L124

You can simply try by adding a link in the product description.

Tell me if I am wrong.

Cheers,
Ilan PARMENTIER
@magento-engcom-team
Copy link
Contributor

Hi @amol2jcommerce. 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-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.2-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-engcom-team
Copy link
Contributor

Hi @ihor-sviziev, thank you for the review.
ENGCOM-4411 has been created to process this Pull Request

@soleksii soleksii self-assigned this Mar 5, 2019
@sdzhepa sdzhepa self-assigned this Mar 5, 2019
@sdzhepa
Copy link
Contributor

sdzhepa commented Mar 5, 2019

@magento-engcom-team give me test instance

@magento-engcom-team
Copy link
Contributor

Hi @sdzhepa. Thank you for your request. I'm working on Magento instance for you

@magento-engcom-team
Copy link
Contributor

Hi @sdzhepa, here is your new Magento instance.
Admin access: https://pr-21531.instances.magento-community.engineering/admin
Login: admin Password: 123123q

@sdzhepa
Copy link
Contributor

sdzhepa commented Mar 5, 2019

✔️ QA passed

Tested ability to open and switch between tabs on Product Details page.
Tested for several product types and with different browsers

@ghost
Copy link

ghost commented Mar 8, 2019

Hi @amol2jcommerce, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

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.

6 participants