Imagine a scenario where you have a <div
with a height specified as a percentage of its parent's height, and this <div
contains a contenteditable element as its child. The goal is to make the child fill all available vertical space and scroll when it reaches the limit of its container.
The current issue is that while setting a fixed pixel height allows the overflow to work correctly (with scrolling appearing), using a percentage height causes the contenteditable element to extend beyond its boundaries.
https://i.sstatic.net/2j5EA.png
Regarding a possible solution, adding display: flex
to the container
seems to resolve the problem. It appears that utilizing flexbox throughout the structure is necessary for proper functionality. You can read more about this concept here.
Additionally, the presence of containerB may appear unnecessary at first glance. However, it serves the purpose of simulating a deeply nested contenteditable element.