Skip to content

[Bug]: DatePicker Compat steals focus on every render #28009

@ParadimeWeb

Description

@ParadimeWeb

Environment Information

  • Package version(s): @fluentui/react-datepicker-compat@0.1.4
  • Browser and OS versions:

Describe the issue:

Actual behavior:

When you have controlled components that re-renders the app, the datepicker steals the focus. Its probably has a bad useEffect code that focuses the component every time it renders.

A simple controlled Input component will have its focus stolen when typing a character in the input.

Expected behavior:

The DatePicker should not steal the focus on every render.

If applicable, please provide a codepen repro:

Simple codepen example of the bug:

Type into input which causes a re-render, and focus moves out of input to date picker.

https://codesandbox.io/s/sad-wright-t2hby7?file=/example.tsx:617-627

Priorities and help requested (not applicable if asking question):

Are you willing to submit a PR to fix? Yes

Requested priority: Blocking

Products/sites affected:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions