fix: Codify component weights with toolbox in front of flyouts. #8432
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.
The basics
The details
Resolves
Fixes #8417
Proposed Changes
I created an enum codifying the weights for the flyout, toolbox, trashcan, and zoom buttons, and provided weight values that give the toolbox higher precedence than the flyout.
Reason for Changes
When the pointer is dragging a block from the workspace to a toolbox or flyout, the drag target areas may overlap, in which case we should decide which should take precedence and handle the event. The flyout's drag area intentionally extends beyond its own bounds, but if the toolbox is also present, then the flyout's bounds include the toolbox. Currently, the flyout and the toolbox have the same weight but the flyout happens to be found first and effectively takes precedence. However, it would be more intuitive for the toolbox to take precedence when the pointer is over it, so I'm giving the toolbox a higher precedence.
Test Coverage
Existing tests pass. I manually tested that the CSS issue from #8417 is resolved.
Documentation
N/A
Additional Information
I did not mark this as a breaking change, but if anyone can think of a reason why users might be depending on the current weights assigned to the flyout, toolbox, trashcan, and zoom buttons, then this should be a breaking change. Previously, the weights were all
1
except the zoom buttons which were2
. I've now assigned different weights to all of them.