epam / epam/UUI

[RTE]: link is inserted in the wrong place when the RTE is used inside a Modal with a focus lock.

Open
#2,900 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
247
Forks
78
Avg merge
14h 27m
Merged PRs (30d)
15

Description

## Problem Description

When using the RTE (Rich Text Editor) component inside a `Modal` with a focus lock, inserting a link on selected text places the link at the beginning of the editor content instead of wrapping the selected text.

## Steps to Reproduce

1. Open a `Modal` that contains an RTE component.
2. Select a portion of text within the RTE.
3. Add a link to the selected text.

## Actual Result

The link is incorrectly inserted at the beginning of the editor.

## Expected Result

The link should wrap the selected text.

## Analysis and Notes

This bug is not present when the `ModalBlocker` component has the `disableFocusLock={true}` prop. This suggests the issue is related to the **focus lock behavior**. When the "add link" modal closes, the focus is likely not being correctly returned to the RTE's last cursor position or text selection, causing the selection to be lost and the link to be inserted at the beginning of the content.

## Environment

* UUI version: **6.2.0**
* Browser name:
* Operating System:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.