Fix: Nested tab groups broken in v2.19.1 #2367
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes #2320 by getting rid of the problems introduced by the Synergy Team with the fix #2299.
The problem was that the mutation observer was never scoped in the first place, using subtree checks to adjust itself even when children updated properties that both tabs and the children share.
This original Problem went unnoticed: The mutation observer originally checked its subtree completely, too.
This leads to the following errors:
disabled
oractive
prop, it will also fire the mutation observers logic.The error became more apparent when we tried to fix the
active
property, because naturally, it is shared in both instances ofSlTabGroup
, making the navigation change of the children group cause a mutation update on the parent :(.With this PR, I tried to:
a) Make sure to hold the original logic for the mutation observer
b) Scope the changes to the first level of mutations by not directly querying the original mutations anymore.
c) Restrict the amount of events for children attribute changes by filtering those we are interested in to make it a little more performant.
On a sidenode, I have not fully understood why we are using a
subtree
check at here at all, but there may be reasons it can be beneficial (e.g. when you have some DOM nodes wrapping the tabs or tab-groups), so I did opt to not change this, too.