Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Use Portal-based slots for the block toolbar #16421
In several occasions we noticed issues with the default Slot/Fill implementation (the one that copes children from the Fill into the Slot). These issues makes it for example impossible to use A Slot inside a Fill.
The "bubblesVirtually" (Portal-based) implementation doesn't suffer from these issues. In this PR, I'm exploring the possibility to move the BlockToolbar slots into portal-based slots. The ultimate goal is that all slots would use the Portal-based implementation.
The problem though is that in several components we rely on event cascading which can be impacted by Portals. For example:
My proposal here is to move away from React event handlers into native event handlers for these particular components where the intent is to rely on the natural DOM tree bubbling.
(I'm not certain at this point that everything is right yet but I'd love testing and thoughts).
requested review from
Jul 4, 2019
jorgefilipecosta left a comment
This is working really well on my tests, I did not find regressions on the post editor and on the widget screen.
The tests are failing but I think it is because we need to update them to use the new way events are set.
So it turns out we have two hidden bugs that this PR highlights and fixes:
aduth left a comment
I ran through some of the previous incompatibilities which were reported last time we tried similar (#3132, #3082, #3075). I also searched broadly for toolbar controls, where I had some expectation that interactions like click+drag / arrow keys might trigger some ancestor handling unintentionally (as described in these issues). Generally it seems to work pretty well here.