hhmx.de

Föderation EN Mo 16.12.2024 15:36:02

Having trouble with React Aria Components and :focus-visible

i.e. the <Button> component seems much more eager to show a focus outline when using a mouse, compared to a normal <button>.

But I think I have to use the library's Buttons to use their Popovers and Modals and such (yes I could do them in vanilla HTML, but for now we're not, because reasons).

Is there any way to make this less eager? Is it something to do with programmatic focus?

Föderation EN Mo 16.12.2024 16:59:54

@sarajw I think that’s an accessibility thing? πŸ€”

Föderation EN Mo 16.12.2024 17:02:39

@cheeaun lol yes. It's just very very eager if you only trust in focus-visible... I found the "fix" but I'm pretty mad about it

Föderation EN Mo 16.12.2024 17:09:26

@sarajw it's eager in aesthetic aspect, right? I was initially kind annoyed by it too, but decided to ignore it, thinking it's probably better for accessibility (I'm no expert) πŸ˜†

Seems like few things in React Aria is quite "opinionated" in a good way, I supposed.

Föderation EN Mo 16.12.2024 17:29:37

@cheeaun lol yeeep but also it turns out if I leverage their own attribute for focus, it works better (see my other reply to myself) - still annoying!

Yes I spent too long trying to get my colleague to ignore it, I was just like please let's just move on. But it is otherwise VERY eager to show a focus ring.

Föderation EN Mo 16.12.2024 18:03:12

@sarajw πŸ˜‚ move on for the sake of accessibility! If it captures your attention so much, it’s probably working *really* well 🫣

Föderation EN Mo 16.12.2024 18:44:18

@cheeaun yeah lol that's my thought. Just chill and get used to focus rings here and there. Better there are more than fewer.