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 nested accordion open #1863

Merged
merged 9 commits into from
Sep 24, 2022
Merged

Fix nested accordion open #1863

merged 9 commits into from
Sep 24, 2022

Conversation

mvorisek
Copy link
Member

@mvorisek mvorisek commented Sep 20, 2022

fix #1693
fix (partly - Accordion only) #1728

@@ -30,7 +30,7 @@ protected function init(): void
$jsError = [$form->js()->form('add prompt', $fieldName, $str)];

// if a form control is part of an accordion section, it will open that section.
$section = $form->getClosestOwner($form->getControl($fieldName), AccordionSection::class);
$section = $form->getControl($fieldName)->getClosestOwner(AccordionSection::class);
Copy link
Member Author

Choose a reason for hiding this comment

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

@mkrecek234 the getClosestOwner method was broken, does this fix #1728 too?

Copy link
Member Author

Choose a reason for hiding this comment

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

@mkrecek234 should be fixed when not nested

protected function renderView(): void
{
if ($this->type) {
$this->addClass($this->type);
}

// Only set Accordion in Top container. Otherwise Nested accordion won't work.
if (!$this->getClosestOwner($this, AccordionSection::class) && !$this->isDynamicSection()) {
Copy link
Member Author

Choose a reason for hiding this comment

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

@ibelar why isDynamicSection was introduced, it is still needed?

@mvorisek mvorisek marked this pull request as ready for review September 20, 2022 16:22
@mvorisek mvorisek changed the title Fix nested accordion Fix nested accordion open Sep 20, 2022
@mvorisek mvorisek merged commit dea8209 into develop Sep 24, 2022
@mvorisek mvorisek deleted the fix_nested_accordion_1693 branch September 24, 2022 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nested accordions static level 2. not works in demo
1 participant