Command bar doesn't resize properly with flex configured
Environment Information
- Package version(s): Latest, as used in the codepen examples here: https://developer.microsoft.com/en-us/fluentui#/controls/web/commandbar
- Browser and OS versions: At least Chrome and Edge
Please provide a reproduction of the bug in a codepen:
~~https://codepen.io/matlkng/pen/BaLZyPp~~ new version: https://codepen.io/ecraig12345/pen/qBrvvrv
This is the exact code from the codepen provided in the first CommandBar example at your official site: https://developer.microsoft.com/en-us/fluentui#/controls/web/commandbar, but with a flex container configure (plus a few extra buttons to make it easy to demonstrate). Remove flex and it works perfectly. Keep flex and it doesn't matter what else you do, the resizing fails in the same way.
Actual behavior:
On resizing the screen, when it becomes narrower than the CommandBar buttons, they do not automatically overflow. Instead, a horizonal scrollbar appears and the missing content is offscreen. Remove 'display: flex' from the 'container' class and it works per the expected behaviour. Even if flex is configured on a higher level container, with 'display: block' configured on the immediate container, the same problem is seen. It seems if flex is configured anywhere in the hierarchy in any form (and I've tinkered for hours!), the dynamic overflow mechanism is disabled and scrollbars appear instead.
The exact same problem can be seen with the DetailsList control, which is actually even more of an issue for us. For that, I hooked into the title re-render callback and found that, in the flex case, the component simply wasn't being re-rendered on screen re-sizing (but was re-rendered frequently after removing flex).
This almost identical issue was reported back in April: https://github.com/microsoft/fluentui/issues/12540
...but was recently closed without a resolution. What surprises me though is that this was more specific than mine. As can be seen from the codepen included, the simple addition of flex, in any form, will cause the problem
As responsive design is absolutely critical to our project, we may have to abandon Fluent UI if this cannot be resolved, which would be a great shame as we are big supporters of this library. If it can't be fixed, an effective workaround would be gratefully received!
Expected behavior:
The expected behaviour is the behaviour seen without flex configured, per the example on the above Fluent UI page, i.e. the buttons to the right that can no longer be displayed should dynamically move to the overflow menu.
Priorities and help requested:
Requested priority: (Blocking, High, Normal, Low)
High
Browser: Chrome 87 FluentUI Version: 7.153.4
I am not having quite the issue that @mattlking is having, but I think it's related.
As described, a command bar wrapped in a flex div is behaving unexpectedly when resizing the screen. In our case we have a similar setup, but when resizing the screen items can become 'stuck' in the overflow when there is plenty of space for them.
Here's a simple codepen: https://codepen.io/duschroe/pen/oNzGZZd
edit 2/22/21: Seems to be more difficult to reproduce now, but can occasionally happen
edit 3/4/21: updated the codepen a bit to consistently reproduce
@mattlking - thanks for the initial feedback.
Our engineers are busy looking at this component in #16791 - where this issue will be addressed. I will add this to our backlog for traceability, until the #16791 is made available to the public. Unfortunately, we cannot provide you an ETA at this moment in time, but rest assured, it is in-progress.. Thanks
@gouttierre #13238 Here's another issue of the same bug if you wanted to add it to #16791
Because this reported issue has not had any activity for over 180 days, we're automatically closing it for house-keeping reasons.
Still require assistance? Please, create a new issue with up-to date details and latest version of Fluent.