fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Dropdown width to fit its longest option width

Open artxach opened this issue 9 years ago • 13 comments

Bug Report

  • Package version(s): (1.14.3)
  • Browser and OS versions: (Firefox 54.0.1 , Windows 2012 Server)

Describe the issue:

When a dropdown has many options with different lengths its width is being changed when selecting some option. Also when the options' list is opened it has a current option's width, so if the shortest option is selected and you open options' list it can word-break longer options

Actual behavior:

Expected behavior:

Let the dropdown by default or by specifying a prop to fit its longest option.

artxach avatar Jul 18 '17 08:07 artxach

Would love to see this fixed.

buckingj avatar Dec 19 '17 06:12 buckingj

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions to Fabric React!

stale[bot] avatar Apr 11 '18 08:04 stale[bot]

Any update on this bug? We are using the dropdown component in many UI pages. Fixing this issue would improve the readability for the user.

Package version(s): (5.64) Browser: All browsers OS versions: Windows 10

manasark avatar Apr 17 '18 05:04 manasark

@artxach @manasark We investigated this bug and need more information to repro. Is it the width of the dropdown input field or the dropdown callout that you want to snap to the longest option? We are not seeing either width change based on which option is selected. The callout always snaps to the width of the input unless the 'dropdownWidth' prop is set. For really long options, the value can be read on hover.

I created this codepen for testing: https://codepen.io/lynamemi/pen/wjapep

lynamemi avatar Apr 20 '18 15:04 lynamemi

@lynamemi We want the dropdown width to fit the longest option in the dropdown input filed.

manasark avatar Apr 24 '18 21:04 manasark

@lynamemi Any update on the above request?

manasark avatar May 07 '18 05:05 manasark

@manasark Still not completely clear on the expected behavior here. Is it:

  1. Dropdown's callout width OR
  2. Dropdown's input field / container width

that you want to snap to the longest option's width?

lynamemi avatar May 07 '18 18:05 lynamemi

@lynamemi option 2

manasark avatar May 08 '18 05:05 manasark

Ok sounds good. That one will probably take a little more time than the other. I can try to get to it in the next couple of weeks.

lynamemi avatar May 08 '18 16:05 lynamemi

For what it's worth, don't we want both 1 and 2?

If I have a dropdown with "foo", "bar", and "baseball" in it, and I select "foo" and then show the dropdown, the dropdown will only truncate that last entry to "bas...".

I suppose if we fix #2, that will also implicitly fix #1, right? Assuming that's the case, that would be ideal. Truncating strings looks terrible in a dropdown, and seeing the dropdown constantly change width depending on what is selected is also a bad experience.

buckingj avatar May 08 '18 16:05 buckingj

@buckingj @manasark - It would be great if one of you submitted a PR for this change - I'm going to unassign myself. It sounds like there are a few different directions we could take that would help you out and a PR would be a great place to continue this conversation. I'm happy to help review.

lynamemi avatar May 09 '18 16:05 lynamemi

This issue has been automatically marked as stale because it has not activity for 60 days. It will be closed if no further activity occurs within 14 days of this comment. Thank you for your contributions to Fabric React! Why am I receiving this notification?

stale[bot] avatar Jul 08 '18 17:07 stale[bot]

This issue has been automatically closed because it has not had recent activity after being marked as stale. If you belive this issue is still a problem or should be reopened, please reopen it! Thank you for your contributions to Fabric React! Why am I receiving this notification?

stale[bot] avatar Jul 22 '18 17:07 stale[bot]