adobe/react-spectrum

[RAC] `<Link>` gets `focus-outline` attributes on window blur.

Opened this issue ยท 6 comments

Provide a general summary of the issue here

On mobile, when a Link is touched, it gets focus-outline attributes and styles on window blur. For client-side routing, if I switch apps to trigger the window blur and then return to the application, the last triggered link retains the focus-outline style.

๐Ÿค” Expected Behavior?

The <Link> should not receive the focus-outline style under any circumstances on mobile.

Based on the documentation:

isFocusVisible [data-focus-visible] Whether the link is keyboard focused.

๐Ÿ˜ฏ Current Behavior

The <Link> gets focus-outline style and attributes on the window blur event. This issue can be easily reproduced on both the website examples and the official public Storybook.

๐Ÿ’ Possible Solution

No response

๐Ÿ”ฆ Context

We are using the <Link> component in the Tab Bar of our mobile navigation, which has a focus-outline style defined. When switching applications back and forth, our Tab Bar links receive the focus-outline style. This is not the expected behavior.

๐Ÿ–ฅ๏ธ Steps to Reproduce

Screen recordings:

Version

1.5.0

What browsers are you seeing the problem on?

Chrome, Safari

If other, please specify.

No response

What operating system are you using?

iOS 18

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

What device and iOS version are you using? I can't seem to reproduce on my iPhone 13 + iOS 18. Here's a
of what I'm seeing:

ScreenRecording_12-05-2024.11-33-45_1.MP4

I work with endre - I just tried and I can reproduce.
iPhone 15, iOS 18.

it happened 3 times in a row but only the first time. After clicking away from the link itโ€™s no longer reproducible.

Ok fourth time it didnโ€™t happen, fifth it did

Ah, okay I can reproduce it now. Thanks for the additional information. At least for me, I have to touch it in a certain way for it to render with the focus ring but I haven't been able to get it consistently.

Seems like previously in other components, focus visible was triggered on window blur and we prevented that by keeping the previous modality so it would probably make sense to do the same here.

Related issues: #1912, #1813