-
Notifications
You must be signed in to change notification settings - Fork 461
Description
🐛 Bug Report
If you want to use Icon as a button:
<FluentIcon Id="idBack" Value="@(new Icons.Filled.Size48.ArrowCircleLeft())" @onclick="OnClick_Back" />
protected async Task OnClick_Back()
{
...
NavigationManager!.NavigateTo("/");
...
}
this triggers the following error in the console:
Blocked aria-hidden on an element because its descendant retained focus. The focus must not be hidden from assistive technology users. Avoid using aria-hidden on a focused element or its ancestor. Consider using the inert attribute instead, which will also prevent focus. For more details, see the aria-hidden section of the WAI-ARIA specification at https://w3c.github.io/aria/#aria-hidden.
Element with focus: svg
Ancestor with aria-hidden: <svg id="idBack" style="width: 48px; fill: var(--accent-fill-rest); cursor: pointer;" focusable="false" viewBox="0 0 48 48" aria-hidden="true" aria-label="Add item"><!--!--><path d="M44 24a20 20 0 1 1-40 0 20 20 0 0 1 40 0Zm-19.87 8.63c.5-.48.5-1.28 0-1.76l-5.61-5.62h14.23a1.25 1.25 0 1 0 0-2.5H18.52l5.61-5.62a1.25 1.25 0 0 0-1.76-1.76l-7.75 7.75a1.25 1.25 0 0 0 0 1.76l7.75 7.75c.48.5 1.28.5 1.76 0Z"></path></svg>
It also doesn't matter whether I set focus to false
<FluentIcon Id="idBack" Value="@(new Icons.Filled.Size48.ArrowCircleLeft())" Focusable="false" @onclick="OnClick_Back" />
What is frustrating is the fact that the app also blocks completely. All the worse because the user has no idea what is happening to the app.
💻 Repro or Code Sample
<FluentIcon Id="idBack" Value="@(new Icons.Filled.Size48.ArrowCircleLeft())" Focusable="false" @onclick="OnClick_Back" />
protected async Task OnClick_Back()
{
...
NavigationManager!.NavigateTo("/");
...
}
🤔 Expected Behavior
You would expect it to work without an error message, such as the button
😯 Current Behavior
As described, if you want to use Icon as a button, the specified error is generated in the console. Sometimes without visible disadvantages (the app continues to run, event is executed) and sometimes the entire app blocks.
If you use Button instead of Icon and show an icon inside Button, it works fine, no error message is triggered.
💁 Possible Solution
Replace icon with button and display icon within the button.
🌍 Your Environment
- Windows
- Chrome
- Net 9
- VS Version 17.13.4
- FluentUI Blazor 4.11.7
pc