Skip to content

Widget parameter depends does not work correctly on specified block #30691

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

Closed
3 tasks
DmitryFurs opened this issue Oct 28, 2020 · 16 comments
Closed
3 tasks

Widget parameter depends does not work correctly on specified block #30691

DmitryFurs opened this issue Oct 28, 2020 · 16 comments
Labels
Component: CatalogWidget Component: Widget Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.0 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@DmitryFurs
Copy link
Contributor

DmitryFurs commented Oct 28, 2020

Preconditions (*)

  1. Magento 2.4-develop
  2. PHP 7, MySQL: ANY
  3. Related issues / prs: Widget parameter depends does not work on specified block #6868 Widget field depends with type block KO #13316 Make sure the depends definition works for custom widgets. Also conve… #30570

Steps to reproduce (*)

  1. Create a custom widget with widget.xml file
  2. Create required select option chooser
<parameter name="category*id" xsi:type="block" visible="true" required="true" sort*order="50"]
    [label translate="true"]Category[/label]
    [depends]
        [parameter name="type" value="category" /]
    [/depends]
    [block class="Magento\Catalog\Block\Adminhtml\Category\Widget\Chooser"]
        [data]
            [item name="button" xsi:type="array"]
                [item name="open" xsi:type="string" translate="true"]Select Category...[/item]
            [/item]
        [/data]
    [/block]
[/parameter]
{code}
1. Create a **custom input/textarea** with validation classes using a custom block
{code:xml}
[parameter name="reviews*to_display" xsi:type="block" visible="true" required="true" sort*order="60"]
    [label translate="true"]Reviews to Display[/label]
    [depends]
        [parameter name="type" value="category" /]
    [/depends]
    [block class="Vendor\Module\Block\Adminhtml\Widget\Parameter\Number" /]
[/parameter]
{code}
{code:php}
[?php

declare(strict_types=1);

namespace Vendor\Module\Block\Adminhtml\Widget\Parameter;

use Magento\Backend\Block\Template;
use Magento\Backend\Block\Template\Context;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Data\Form\Element\Factory as ElementFactory;

class Number extends Template
{
    /**
    * @var ElementFactory
     */
    private $elementFactory;

    /**
    * @param Context $context
    * @param ElementFactory $elementFactory
    * @param array $data
     */
    public function __construct(
        Context $context,
        ElementFactory $elementFactory,
        array $data = []
    ) {
        $this-]elementFactory = $elementFactory;
        parent::__construct($context, $data);
    }

    /**
    * @param AbstractElement $element
    * * @return AbstractElement
     */
    public function prepareElementHtml(AbstractElement $element)
    {
        $input = $this->elementFactory->create('text', ['data' => $element->getData()>);
        $input->setId($element->getId());
        $input->setForm($element->getForm());
        $input->setData('class', 'widget-option input-text admin__control-text');
        $input->addClass('validate-number')->addClass('validate-greater-than-zero');
        if ($element->getData('required')) {
            $input->addClass('required-entry');
        }

        $element->setData('after*element*html', $input->getElementHtml());
        $element->setData('value', null);

        return $element;
    }
}
  1. Create new Widget
  2. Change depended select
  3. Press Save button

Expected result (*)

  1. When the chooser is hidden, the validation does not run on hidden nested inputs
    image
  2. The input location and associated label should be hidden according to the dependency
    image

Actual result (*)

  1. Validation triggers on hidden nested input fields
    image
    Switch select to display chooser
    image

  2. Only the input field is hidden, the label remains visible
    image

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • < ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [ > Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Oct 28, 2020

Hi @DmitryFurs. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

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

Please, add a comment to assign the issue: @magento I am working on this


⚠️ According to the Magento Contribution requirements, all issues 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 issues 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

@sdzhepa sdzhepa added the Reported on 2.4.x Indicates original Magento version for the Issue report. label Nov 11, 2020
@magento-engcom-team magento-engcom-team added Reported on 2.4.0 Indicates original Magento version for the Issue report. and removed Reported on 2.4.x Indicates original Magento version for the Issue report. labels Nov 13, 2020
@engcom-Alfa engcom-Alfa self-assigned this Nov 16, 2020
@m2-assistant
Copy link

m2-assistant bot commented Nov 16, 2020

Hi @engcom-Alfa. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@engcom-Alfa engcom-Alfa added Component: Widget Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. Priority: P2 A defect with this priority could have functionality issues which are not to expectations. labels Nov 16, 2020
@engcom-Alfa engcom-Alfa added Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch and removed Progress: dev in progress labels Nov 16, 2020
@engcom-Alfa
Copy link
Contributor

The issue is reproducible on fresh 2.4-develop.

Actual Result: ✖️

Peek 2020-11-16 10-57

@engcom-Alfa engcom-Alfa added the Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed label Nov 16, 2020
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-Alfa
Thank you for verifying the issue. Based on the provided information internal tickets MC-39096 were created

Issue Available: @engcom-Alfa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@m2-assistant
Copy link

m2-assistant bot commented Dec 11, 2020

Hi @engcom-Alfa. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

    1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
    1. If the issue is not relevant or is not reproducible any more, feel free to close it.

@engcom-Alfa
Copy link
Contributor

@DmitryFurs I'll check it.

@engcom-Alfa
Copy link
Contributor

engcom-Alfa commented Dec 14, 2020

Hi @DmitryFurs, @ihor-sviziev .

The issue, described in the comment #30691 (comment), is still reproducible on fresh 2.4-develop.

Actual Result: ✖️ Only the input field is hidden, the label remains visible

Peek 2020-12-14 09-33

So, we will reopen the issue.

@engcom-Alfa engcom-Alfa reopened this Dec 14, 2020
@m2-community-project m2-community-project bot added Progress: dev in progress and removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: ready for confirmation Progress: done Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch labels Dec 14, 2020
@ihor-sviziev
Copy link
Contributor

@engcom-Alfa the labels just disappeared. Could you add them back?

@ihor-sviziev ihor-sviziev added Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed and removed Fixed in 2.4.x The issue has been fixed in 2.4-develop branch labels Dec 16, 2020
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @ihor-sviziev
Thank you for verifying the issue. Based on the provided information internal tickets MC-39096 were created

Issue Available: @ihor-sviziev, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@magento-engcom-team
Copy link
Contributor

Hi @DmitryFurs.

Thank you for your report and collaboration!

The related internal Jira ticket MC-39096 was closed as Fixed.

The fix will be available with the upcoming 2.4.3 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.4.x The issue has been fixed in 2.4-develop branch label May 11, 2021
@zakdma
Copy link
Contributor

zakdma commented May 11, 2021

Additional case described in comment fixed in scope of internal code delivery of MC-39096.

@hostep
Copy link
Contributor

hostep commented May 12, 2021

Found 2 commits tagged with MC-39096, just putting them here in case this is helpful:

  • f1e5c45 (already included in Magento 2.4.2)
  • 95e5361 (unreleased so far)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: CatalogWidget Component: Widget Fixed in 2.4.x The issue has been fixed in 2.4-develop branch Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.0 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Archived in project
Development

No branches or pull requests

8 participants