# Feature OP-11221 - Trap focus within a modal dialogue when tabbing to cycling through interactive elements

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

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | 12.4.0 |
| Sprint | 12.4.0 |
| Backlog bucket |  |
| Votes |  |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

_No work packages_

## Technical Details

| Attribute | Value |
| --- | --- |
| Module |  |
| Feature Flag |  |
| Requires doc change | No |
| Enterprise plan |  |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Feature Lead |  |
| Developers |  |
| Designer | Parimal Satyal |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| PD (min) |  |
| PD (max) |  |
| Work |  |
| Labor costs |  |

## Description

This is an extension to the behaviour of the modal dialogue described in <mention class="mention" data-id="43684" data-type="work_package" data-text="#43684">\#43684</mention>. 

Today, when a modal is displayed:

  - pressing tab on the keyboard cycles through interactive elements (as expected), but this includes elements that are outside of the modal (like the main search bar)

### **Acceptance criteria**

Change the behaviour to make the modal dialogue more accessible for users depending on keyboard navigation:

  - Trap focus in the modal:
      - Tabbing when a modal is open cycles only through interactive elements *within* the modal.

### Open 

  - Should we also define a default action in the action bar to set the focus automatically too?
      - Pro: Easier to press enter to dismiss the modal if modal was opened in error.
      - Con: This makes no sense for modals with input fields or actions in the modal container; the user would have to press tab multiple times before getting to the start of the form, which is undersirable.
