In mobile view, Datepicker zooms into input field after date is selected
Environment Information
- Package version(s): Fabric React 6.213.0
Actual behavior:
When using Datepicker from Office Ui Fabric React v6.213.0 in a mobile device (e.g. iPhone), the date picker zooms in on the input field after a date is selected. This behaviour can be viewed in the Default DatePicker example in the link above, when accessed via mobile device.
It is unclear if this is a feature or a bug. If the former, is there a method by which this behaviour can be disabled?
The zoom appears relevant in cases where the DatePicker is configured to allow text input, however, when text input is not set—as in the Default DatePicker example above—the zoom is still triggered.
Of note, the Datepicker in v7.105.10 does not display the same zoom behaviour. However, currently I am restricted to using v6.
Expected behavior:
As in v 7.105.10, after a date is selected, no zoom is triggered.
Requested priority: Normal
@joselarios Thanks for the submission! Do you know if this happens in all mobile devices or only in android? I believe that iPhones zoom to inputs as a feature of the phone/browse when focus moves to the input.
@joschect , Thank you for getting back to me.
I've found that the zoom/focus behaviour does not happen on an Android phone, but it does happen on iPhones.
More specifically, it only happens on iPhones for Office UI Fabric v 6.213.0. The zoom/focus behaviour does not happen on iPhones with Office UI Fabric v 7.105.10.
@joselarios Thanks for the additional information! I did some more digging and it does look like this is expected behavior on iphones when a text field is focused. Here's a codepen that you can play around with. You'll see if you remove the styling on the content div that both the textfield and datepicker zoom in quite a bit when interacted with.
I tested on our example page as well and I see the most current date picker also doing a slight zoom, so I suspect it's related to the page size rather than a specific problem with the date picker.
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!
Hi @joschect ,
Thanks for looking into this further!
The codepen does clearly exemplify the zooming behaviour when selecting a date. Additionally, there is also a slight zooming behaviour when testing on the example page using the most current date picker, as you noted.
However, from what I can tell, the zooming behaviour (using the most current date picker) only happens if the user taps into the input field a second time. In version 7, then, we see the following:
(1) User can tap on the date picker input field to open the date picker without a zoom (2) User can select a date using the date picker without a zoom (3) User can tap on the date picker input field a second time zooming into the input field.
The behaviour of the most current date picker seems appropriate to me in (1) – (3).
But, with version 6, we see that (2) doesn't hold: after the user selects a date using the date picker, there is a zoom that happens.
Is there a difference in how the date selection is being handled by the most current version that prevents the zooming behaviour when selecting a date? Or could it be related to something else?
Hey @joselarios I'm not sure. There were a fair amount of changes between 6 and 7. @lorejoh12 might be able to comment more into what those were. That being said, I don't see any obvious focus differences between the two.
I did a little more experimentation in terms of making them more similar and I'm not able to stop the issue from reproducing. I am a little confused because I'm seeing that 7 does get zoomed into, at least when I try it on https://developer.microsoft.com/en-us/fluentui?/controls/web/datepicker#/ Can you confirm that you see no zoom on the 7 page?
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!
On an iPhone a text field will zoom in when focused if the font size is smaller than 16px. Not sure about android as I do not have one. So to prevent the DatePicker from zooming in when clicked you can change the font size of the input element to be 16px.
Here is an updated codepen showing this.
Hi @joschect
Thanks again for looking into this further. I very much appreciate it.
I can confirm that, in the link provided, no zooming happens after selecting a date on the date picker. This was the experience on an iPhone Xs.
As far as I can tell, the zooming only appears to happen if the user double taps into the input field, which is likely the expected behaviour.
Hi @pmsandhu
Brilliant catch! Testing the codepen link on iPhone prevents the zooming behaviour.
I will test this styling change in my code to confirm and close this issue.
Thank you kindly for looking into the issue and for the provided codepen. Super helpful!
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 Fluent UI!
Thanks again @pmsandhu! The font-size styling fix does prevent the zooming behaviour.
@joschect: While the styling edit noted above does prevent the zooming in, it remains a somewhat inelegant solution, as it requires the date picker to have enlarged font. This can appear somewhat out of place next to other form controls.
(Of course, one may adjust all the form controls to likewise use the 16px font size, but this may suffer from the same issue of appearing out of place next to other Fluent UI components.)
Additionally, since v7 of the DatePicker does not exhibit the same zooming behaviour (upon selecting a date), and, importantly, it does not require 16px fonts, I am hopeful that there is some way to understand why the v6 DatePicker does exhibit this behaviour. Hopefully that will lead to a solution that does not require editing the font size of this and/or other form controls.
Please feel free to close this issue should further review not be feasible.
Glad you were able to find a workaround! Unfortunately since version 6 is pretty old at this point and we're currently focusing on improvements to performance and coherence in preparation for version 8, we probably won't have time to dig into this further, sorry. So I'm going to close this.