react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

`usePress()` getting stuck on keyboard navigation to `_blank` target

Open nwidynski opened this issue 1 year ago โ€ข 5 comments

Provide a general summary of the issue here

When initiating navigation on an <a/> element with a _blank target and props spread on via useLink() or usePress(), the link will get stuck in pressed state if pressed via keyboard.

๐Ÿค” Expected Behavior?

usePress() should reset its pressed state, when navigating to new _blank target.

๐Ÿ˜ฏ Current Behavior

isPressed remains stuck in true, even when re-pressing the link.

๐Ÿ’ Possible Solution

I noticed this issue on the <Link /> RAC but I am pretty sure the issue lies in usePress() failing to pickup the pointer up event when navigating to a _blank target. Maybe an event listener for a navigation event could be added to force a state reset.

๐Ÿ”ฆ Context

No response

๐Ÿ–ฅ๏ธ Steps to Reproduce

  1. Visit the official docs example
  2. Initiate navigation through keyboard ENTER.
  3. Observe the Link now being stuck in data-pressed

Version

latest

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

OSX

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

nwidynski avatar Mar 25 '24 15:03 nwidynski

Can confirm, thanks for the issue!

snowystinger avatar Mar 26 '24 00:03 snowystinger

Is anyone working on it?

subashcs avatar Apr 06 '24 04:04 subashcs

@subashcs doesn't look like it, please go ahead

snowystinger avatar Apr 07 '24 23:04 snowystinger

Hi @snowystinger,

I noticed that this issue is currently unassigned. Could you please let me know if @subashcs is working on it or if they have expressed interest in doing so? If not, I would be happy to take it on.

Thank you!

parthsali avatar Aug 20 '24 17:08 parthsali

Go for it, that last comment was in April and there's no linked PR. Don't worry too much about the assignment.

snowystinger avatar Aug 20 '24 22:08 snowystinger