Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The control grabs the input focus when setting a new document on it #233

Open
dlemmermann opened this issue May 31, 2022 · 2 comments
Open
Labels
bug Something isn't working

Comments

@dlemmermann
Copy link
Collaborator

In our app the user can select one of several "notes". Each one of them stores its own "Document". When the document gets "loaded" into the RichTextArea the control requests the focus. It should definitely not do that.

@dlemmermann dlemmermann added the bug Something isn't working label May 31, 2022
@dlemmermann
Copy link
Collaborator Author

In RichTextAreaSkin, line 432:

        control.documentProperty().addListener((obs, ov, nv) -> {
            if (viewModel.isSaved()) {
                getSkinnable().requestFocus();
                return;
            }
            if (ov != null) {
                dispose();
            }
            setup(nv);
        });

@dlemmermann
Copy link
Collaborator Author

And another one is inside the refreshTextFlow() method:

    // TODO Need more optimal way of rendering text fragments.
    //  For now rebuilding the whole text flow
    private void refreshTextFlow() {
        objectsCacheEvictionTimer.pause();
        try {
            nonTextNodes.set(0);
            viewModel.resetCharacterIterator();
            lastParagraph = paragraphSortedList.get(paragraphSortedList.size() - 1);
            // this ensures changes in decoration are applied:
            paragraphListView.updateLayout();

            if (nonTextNodesCount != nonTextNodes.get()) {
                // when number of images changes, caret
                requestLayout();
                nonTextNodesCount = nonTextNodes.get();
            }
            getSkinnable().requestFocus();
        } finally {
            objectsCacheEvictionTimer.start();
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant