Open MarkStega opened 3 years ago
Seems that it's not an MDC issue as such, but rather ellipsis + scrollbar HTML one. I managed to workaround this by "resetting" the menu width after opening. Not sure if there's better solution
// do this after open
menuElement.style.width = '0';
setTimeout(() => menuElement.style.width = '', 1);
The width "reset" worked only in Chrome. A better solution is to display the scrollbar before getting inner dimensions.
As a workaround menu-surface
adapter could be monkey patched with the following
getInnerDimensions: () => {
const firstChild = this.root.firstElementChild as HTMLElement;
this.root.style.overflowY = this.root.offsetHeight < firstChild.offsetHeight ? 'scroll' : '';
return {
width: this.root.offsetWidth,
height: this.root.offsetHeight
};
}
Bug report
If you create a list with text elements for use in a menu the list is nicely expanded horizontally to accommodate the widest text. If, however, the list 'runs out of room' then a vertical scrollbar is appropriately added. However, the scrollbar is 'in' the content area of the list and whatever lengthy text determined the width gets truncated with an ellipsis.
Steps to reproduce
Create a menu
Actual behavior
Observe the truncated text:
Expected behavior
The menu should have the scroll width added in to avoid the truncation
Screenshots
Your Environment:
Additional context
Possible solution