New focus handling behaviour
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 285
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 59
Description
Feature Request Description
According to the latest visual and interaction designs, the focus should behave like this:
- on desktop, always show a focus outline, no matter if the focus was received via mouse or keyboard
- on mobile, show focus outline only when focus is received via external keyboard and never show focus when the element is receiving focus via touch.
Input elements remain unchanged - they always show focus as additional attention is needed.
To be clarified:
- Select receives focus via keyboard on mobile, has an outline and can be opened with enter. The same is not the case for MultiCombobx and will be tacked separately.
Proposed Solution
A pure CSS solution is possible by using :focus-visible which will match only when focus is received via keyboard. This is sufficient for mobile.
For desktop, the :focusselector should be used with an additional attribute on the host manually set by the component.
Use :focus-within if a nested component can receive focus, such as a button with avatar, the avatar will get the focus when touched.
The manual attributes [focused] and setting them via focusin and focusout handlers is discouraged and should be clarified additionally.
Example implementation
#8253
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the example implementation in #8253 and compare it with the requested desktop and mobile focus behavior. Check how focus-visible, focus, and focus-within apply to components, while keeping input behavior unchanged. Done means the specified focus outlines work for mouse, keyboard, touch, nested components, and Select on mobile.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100