fluentui icon indicating copy to clipboard operation
fluentui copied to clipboard

Can't set maxWidth for DatePicker

Open jayleems2018 opened this issue 7 years ago • 11 comments

Environment Information

  • Package version(s): (fill this out)
  • Browser and OS versions: (fill this out if relevant)

Please provide a reproduction of the bug in a codepen:

Actual behavior:

There is no way to adjust width of Datepicker. I tried your sample under https://github.com/OfficeDev/office-ui-fabric-react/tree/master/packages/office-ui-fabric-react/src/components/DatePicker/examples

It does not work. It complains: validation(css 4.0): "global" is not a valid pseudo-class

Expected behavior:

Need to be able to override the adjust width of DatePicker to meet UI specs

Priorities and help requested:

Are you willing to submit a PR to fix? (Yes, No)

Requested priority: (Blocking, High, Normal, Low)

Products/sites affected: (if applicable)

jayleems2018 avatar Feb 23 '19 20:02 jayleems2018

Hi @jayleems2018 can you elaborate on which max width you're trying to change. Can you post a mockup of your intended changes in mind please?

leddie24 avatar Feb 25 '19 20:02 leddie24

sure you can add following control to any DatePicker as My question is, could you adjust size for DatePicker to align with length of input field?

You can play with DatePicker on https://codepen.io/anders-sch-rmann/pen/omVbxK

jayleems2018 avatar Feb 26 '19 09:02 jayleems2018

any input box as

jayleems2018 avatar Feb 26 '19 09:02 jayleems2018

you could find mine there: https://codepen.io/jayleems2018/pen/gEOEBm

jayleems2018 avatar Feb 26 '19 09:02 jayleems2018

My input tag is added before DatePicker tag

jayleems2018 avatar Feb 26 '19 09:02 jayleems2018

After looking at the suggested component usage, it doesn't seem like it's intended to be resized by design.

Don't attempt to force resize the control in any way.

@lorejoh12 can you confirm?

leddie24 avatar Feb 27 '19 23:02 leddie24

To be clear, I don't know if user can resize DatePicker. I think this is a bug and this is failed based on our design spec if it has to show a long length field by default, that forced to show a horizontal scrollbar in our case. Please address.

jayleems2018 avatar Feb 28 '19 06:02 jayleems2018

Finally, I figured out a working sample as on https://codepen.io/jayleems2018/pen/rROWxN. Could you make DatePicker align with input field on right?

jayleems2018 avatar Feb 28 '19 08:02 jayleems2018

Hi @jayleems2018, thanks for the reply.  I want to make sure we're on the same page; your codepen show a basic text input field above the DatePicker control that can be variable in width.  You want the DatePicker control to align with that text input and either grow or shrink in size (in conjunction) with the text input box correct?  Currently, with the DatePicker's usage guidelines, we generally recommend not modifying the width of the container or the picker itself, since the layout isn't designed to be resized dynamically.

That being said, it would be great to understand more about your UI spec and how/why the current DatePickerbehavior feels buggy and doesn't suit your projects needs. Can you share more details about your UI spec; maybe we can find an interim solution.

leddie24 avatar Mar 04 '19 20:03 leddie24

@jayleems2018 messaged me offline on Teams. Here's the example of his UI usage:

microsoftteams-image

@jayleems2018: I'm not experiencing that when I implement a DatePicker in a Panel on my end. I just dropped DatePicker in the basic small right side example of Panel and it shrinks/grows to fit the Panel width.

image

Do you have any custom CSS that may be overriding the DatePicker width? Is there a repro site that you can share via Teams?

leddie24 avatar Mar 06 '19 18:03 leddie24

This issue has been automatically marked as stale because it has marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your contributions to Fabric React!

msft-github-bot avatar Mar 10 '19 19:03 msft-github-bot