# Bug OP-16645 - Autocompleter should not get autofocus by default

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-16645

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | Accessibility, Modules and project features / Project settings |
| Target versions | 16.2.0 |
| Observed in versions | 15.2.0 |
| Sprint | 16.2.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 15.2.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | Yes |
| Pull preview |  |
| List | UX/UI |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable | Alexander Coles |
| Product manager |  |
| Developers | Henriette Darge, Alexander Coles |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

There are multiple ways to reproduce the issue

On project creation page

1.  On the main page, click the green "+" button on the top header, and select "Add project"

2.  On the project creation page, the "subproject of" field is automatically focused

On watchers tab

1.  Go to a work package in any view (split, full, etc)

2.  Click on the watchers tab

3.  The "Search" field to search users is autofocused

On project settings page

1.  Go to Administration -\> Projects -\> Project attributes

2.  Create a project attribute of type "User" (or "Version")

3.  Pick a project, and go to its Project settings -\> Project attributes page

4.  Enable the project attribute that you just created

5.  Now go to the Project settings -\> Information page

6.  The "User" field for the project attribute is autofocused, it can even scroll the page to the bottom if there are a lot of other project attributes

### What is the buggy behavior?

  - The focus is automatically set without a good reason, which breaks the flow for screen readers and even for non-screen readers.

  - Actually, it's all autocompleter fields which are autofocused by default due to a larger change done some time ago. This has an impact on a lot of pages.
    
      - [Here is the relevant code for it](https://github.com/opf/openproject/blob/6087bcc49105c8ee24378bd67144659d0e46b6ca/frontend/src/app/shared/components/autocompleter/op-autocompleter/op-autocompleter.component.ts#L107) (`focusDirectly = true`).

### What is the expected behavior?

1.  The focus should not be automatically set to autocompleter fields

2.  Meaning the `focusDirectly` parameter should be `false` by default
    
    1.  Changing focus can confuse users and harm accessibility. It should be a thoughtful decision, not a default.

### Screenshots and other files

*<img class="op-uc-image op-uc-image_inline" src="https://community.openproject.org/api/v3/attachments/316853/content">*

### Environment information

**OpenProject version**

OpenProject 15.2
