Unify handling of scrollable containers while positioning the UI
Provide a description of the task
There are several places in the codebase that use specific algorithms to anticipate situations when some elements get cropped by scrollable parents and/or they get off the viewport.
My gut tells me, they have a lot in common and we should centralize them. There's a Rect method called getVisible() that does almost exactly that (almost because it does not consider the viewport/document).
I think helpers like getScrollableAncestors() and getElementsIntersectionRect() and the logic built on top of them should find their way into Rect#getVisible(). This would simplify and bulletproof the code if there were a single method to do it all. This could mean some refactoring in the places I listed below but I think the benefits outweigh the hassle.
In StickyPanelView
https://github.com/ckeditor/ckeditor5/blob/16842686a685b325894da4ae256b04fee1dd6aba/packages/ckeditor5-ui/src/panel/sticky/stickypanelview.ts#L269-L332
In PoweredBy
https://github.com/ckeditor/ckeditor5/blob/16842686a685b325894da4ae256b04fee1dd6aba/packages/ckeditor5-ui/src/editorui/poweredby.ts#L350-L366
In getOptimalPosition()
https://github.com/ckeditor/ckeditor5/blob/16842686a685b325894da4ae256b04fee1dd6aba/packages/ckeditor5-utils/src/dom/position.ts#L115-L120
📃 Other details
- Browser: …
- OS: …
- CKEditor version: …
- Installed CKEditor plugins: …
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.
We've closed your issue due to inactivity. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).