Skip to content

[dev-v5] fix: conditional AutoFocus#4699

Description

馃悰 Bug Report

The AutoFocus parameter does not work when a component is being rendered conditionally.

馃捇 Repro or Code Sample

<FluentSwitch @bind-Value="showInput" Label="Show Input" />

<br />

@if (showInput)
{
    <FluentTextInput @bind-Value="test" Label="Test" Autofocus />
}

@code {
    private string test = string.Empty;
    private bool showInput;
}
  1. Run code
  2. Press the switch
  3. Notice that the input won't get focused

馃 Expected Behavior

The input should become focused once it is visible

馃槸 Current Behavior

The input will become visible but won't be set in focus.

馃拋 Possible Solution

馃敠 Context

If you just render the component without the if then it actually will get focused.

馃實 Your Environment

  • OS & Device: Windows 11 64 Bit
  • Browser latest Firefox, Chrome, Edge
  • latest dev-v5 branch

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:fluent-ui-web-componentsA Fluent UI Web Component specific issuebugA bugv5For the next major version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions