facebookarchive / draft-js

A React framework for building text editors.
https://draftjs.org/
MIT License
22.56k stars 2.64k forks source link

DraftJs current editor focus should be inbuilt #2747

Open MrVibe opened 3 years ago

MrVibe commented 3 years ago

Do you want to request a feature or report a bug?

feature In case of multiple DraftJS editors. The draftJs requires a container element and a ref to get into focus.

What is the current behavior?

Extra code require for something which should be built by default into the container

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

The current recommendation by DraftJS is not a clean implementation of an editor should come into focus mode.

What is the expected behavior?

The DraftJS should automatically detect that when a user is typing into the box it is in focus.

Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?

All versions of DraftJS.

MrVibe commented 3 years ago

The documentation link : https://draftjs.org/docs/advanced-topics-managing-focus/#translating-container-clicks-to-focus , the issue is that there is inconsistent behaviour here. While you can start typing into the DraftJS box, the decorators, blocks, entities do not come into focus automatically. This has to be handled from outside .

1 Either the user should not be able to type into the DraftJS editor unless the editor comes into focus by external code.

2 Or The editor should automatically come into focus when user starts typing into the editor.