abp icon indicating copy to clipboard operation
abp copied to clipboard

Blazor - At first opening, welcome message has border unless you click anywhere.

Open oykuermann opened this issue 1 year ago • 6 comments

App: Blazor Server & Blazor Web Assembly Version: 8.2 pre-rc

At the first opening of the page, the welcome message has border unless you click anywhere.

screencast-localhost_44349-2024.04.29-17_25_05.webm

oykuermann avatar Apr 29 '24 14:04 oykuermann

It's default Microsoft's Win11 focus effect. It's not related to anything in CSS or website content

It's also standard in browsers: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex

You can navigate visual elements with TAB key in your keyboard

enisn avatar Apr 29 '24 17:04 enisn

I'll take a look at Blazorise it it uses focus by default. But probably it's for accesibility

enisn avatar Apr 29 '24 17:04 enisn

Negative tab index is an accessbility standard it's not a bug or unwanted action: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex

It's not related to Blazorise, it's related to Blazor enhanced navigation. Since we started using App.razor with the new Blazor Web App pattern, it's already been implemented in the new Blazor version as a accessibility feature.

I do not suggest hiding the focusing effect, but if needed @armgnunlu can hide it via CSS.

enisn avatar Apr 30 '24 07:04 enisn

Isn't this done by this line of code? https://github.com/abpframework/abp/blob/a681005cf75f6d10ba9632efe0d0144e89d7a17f/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/Routes.razor#L12

BenWhite27 avatar May 03 '24 07:05 BenWhite27

Isn't this done by this line of code?

https://github.com/abpframework/abp/blob/a681005cf75f6d10ba9632efe0d0144e89d7a17f/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Client/Routes.razor#L12

Yes, I wrote wrong, it's not App.razor, it's from Routes.razor

enisn avatar May 03 '24 07:05 enisn

Sorry, maybe I misunderstood the issue. I thought the problem was that the H1 element is getting focused on first load, in which case removing that line was the fix. But if it's just that there is a focus ring being applied to the H1 I'd agree that it's expected behaviour that shouldn't be changed.

Maybe focusing to a form element on the page is the best way to demonstrate the FocusOnNavigate component?

BenWhite27 avatar May 03 '24 10:05 BenWhite27