Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: focusing an element using useFocusObserved hook focuses without outline after pressing enter in an input #33778

Open
2 tasks done
skipcheru opened this issue Feb 5, 2025 · 1 comment

Comments

@skipcheru
Copy link

Component

Utilities

Package version

9.55.0

React version

18.2.0

Environment

N/A

Current Behavior

After pressing enter in a searchbox or input, focus moves to the targeted element but it does not have focus outline. It seems that tabster does not consider Enter key as switching to keyboard navigation mode for input fields.

Expected Behavior

The focused element should have focus outline when using keyboard if the previous active element was input and user pressed enter key.

Reproduction

https://stackblitz.com/edit/ubivawfw?file=src%2Fexample.tsx

Steps to reproduce

  1. Navigate to the example on StackBlitz
  2. Type into the input field next to Reset button and press Enter key.
  3. Observe the focused on load button has no focus outline.

Native inputs don't have the same problem and pressing Enter will trigger :focus-visible as demonstrated in this sandbox

Are you reporting an Accessibility issue?

None

Suggested severity

High - No workaround

Products/sites affected

No response

Are you willing to submit a PR to fix?

no

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@ling1726
Copy link
Member

ling1726 commented Feb 5, 2025

Similarly this will happen for contextmenu events as well if the user uses shift+f10 to open a context menu. However in this case we can make an educated guess since on windows using shift+f10 means that the button won't be 2 (right click). Test on

  • Chrome - value is -1
  • Edge - value is -1
  • Firefox - value is 0 (this could also be a garbage value since it means the user used main button to open a context menu)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants