UI5 / UI5/webcomponents

New focus handling behaviour

Open
#8,250 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request TOPIC B TOPIC P TOPIC RD TOPIC RL
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.