microsoft / microsoft/fluentui-blazor

[dev-v5] fix: Focus on page navigation

Open
#4,968 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:needs-investigation v5
Dominant language
C#
Stars
4.8k
Forks
483
Avg merge
14h 41m
Merged PRs (30d)
68

Description

🐛 Bug Report

There is a weird glitch when using the Autofocus parameter for input components. Whenever a page navigation is happening then autofocus will be ignored.

For some reason this is not the case in the demo project but I couldn't figure out why.

This issue might be related to #4699

💻 Repro or Code Sample

https://github.com/MarvinKlein1508/FluentUI-Autofocs-navigation-issue

  1. Run the project
  2. Click on counter
  3. See that the input is not focused
  4. press f5
  5. see the input will be focused

For the demos use: https://github.com/MarvinKlein1508/fluentui-blazor/tree/focus-issue

  1. Navigate to /Debug/Test
  2. Click any of the links/buttons
  3. See element will be focused

🤔 Expected Behavior

I expect the input to be focused

😯 Current Behavior

The element won't be focused in a blank fluent ui app.

💁 Possible Solution

🔦 Context

🌍 Your Environment

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the linked Autofocus navigation repro and reproduce the failure by clicking counter, then compare it with the demos at /Debug/Test on the focus-issue branch. Trace the Autofocus behavior during page navigation and verify that the input receives focus after navigation in a blank Fluent UI app without requiring a refresh.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.