-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Editor scrolls to bottom when pressing enter in the middle of a big paragraph #304
Comments
How many characters in the paragraph? |
I tested with about 8000 characters in one paragraph. It generally occurs when the paragraph is big enough that I need to scroll to see all of it. If I scroll to the somewhere in the middle and press enter, that's when the editor scrolls to the bottom. |
Ok, I'll check it out. What's the use case for an 8000-character paragraph, btw? :) |
The 8000 was just to make the bug appear on desktop :). My use case was on
|
@jainp @hellendag It doesn't matter what the paragraph length it. This bug occurs when a block is split and the end of the block is outside of the viewport. It can be reproduced by using very little test and just positioning the editor in a way that the paragraph isn't fully visible in the viewport. |
@hellendag unfortunately I have no time right not to investigate this any further, but I've tracked down the issue to this line: https://github.com/facebook/draft-js/blob/master/src/model/transaction/splitBlockInContentState.js#L61 Removing the selection merging gets rid of the scrolling issue but obviously leaves the selection in the previous block. So I assume it has something to do with the way the selection is updated. // edit |
I think it's this line? If the bottom of the focused block is outside of the viewport ( |
Hi @hellendag , best |
thinking it twice, maybe it would be a good idea to not calculate scroll deltas at all, and just scroll into the current cursor (the active element) after enter. |
I have this issue too. When do you plan to fix it? @hellendag |
Is there any progress on this issue. It's really a lot of pain for my team. @hellendag ? |
In my Draft integration on my text editor I've added some logic on handleReturn, it's not optimal, but at least improves the UX on this issue. |
Hi, is there any progress on fixing this? It seems this is still an issue in the latest version. |
still facing this issue :( |
@hellendag This is a major issue, but looks like it is being neglected, is it ever going to be fixed? |
This is a very serious issues, how come it is not yet addressed? The use cases are very simple, having paragraphs with 8000 chars is not needed. I have 3 editors on one page with each tall enough for 6-7 lines of text per size of view, they are vertically scrollable. Once I have more then 7 lines of text, any edit with return pressed in the top visible lines is auto-scrolling the editor to the end. This is a showstopper for us...no user will be willing to accept this scrollbar jumping behaviour. Please fix asap. |
Actually I have tested this more and it looks like the behaviour of auto scrolling to end on return is related to the component hierarchy and potentially css styles. I have a bare bones draftjs editor up and running just by itself and return works fine. But as soon as I use it as a deeply nested component inside the bigger app, pressing return starts exhibiting the scroll issue. I am using draftjs 0.10.1 and 0.10.0 and React 15.4.2... if I have 3 editors one below the other on same page. first one behaves properly |
@houkanshan - you are correct. That line of code causes the issue. or Scroll.setTop below...
I commented it out and now all editors everywhere work fine. The calculations or the logic is 100% incorrect. Please fix this! |
The fix is TRIVIAL. change this line: to read: Why would it take so long to fix ???? |
@andpor, if you could submit a PR with that fix, that would be great! |
Will do |
PR Submitted....let's see how long it will take to merge...1223 |
When is this going to get merged? |
We are facing this issue as well.. please merge. Thank you! |
We were able to get a work around for this by injecting |
Almost two months have passed and this PR is still not merged...despite multiple people raising the defect...any reason why this is still not merged ? |
4 months have passed a the PR is still open. Why has it not been merged yet ?????? |
I think the fix has been incorporated into draftjs codebase somehow although PR does not appear as merged. |
This issue still exists. Can easily reproduce it on draftjs.org. |
Reworked code for adopting scroll position to new block (after pressing Enter). Deals with huge blocks nicely.
Any updates? |
We're steel waiting for fix. :( |
From what I can see what's missing here is for someone to rebase the existing PR and fix the conflicts. @justinlazaro-ubidy @Arinteck could either of you attempt this if you want it fixed? |
set DraftEditor-root overflow auto is useful, if use css-module need add : global
is fixed |
Didn't work for me... =( |
@lucasvmiguel not surprised.... my approach seems like the only one that really works but it has taken VERY long time to be merged....why? i do not know.... @thibaudcolas what is the latest? why is this taking so long?? |
@andpor not sure why you @-me, I have no idea. This is probably better asked on the PR than here. If you want my two cents, looking at the PR, no matter how small you think the change is I'm pretty sure it would be useful if you:
|
You can take unit tests from my PR: #1598 |
Submitted a PR based on @andpor's PR, just fixed the typo/extra space. |
Summary: Should fix facebookarchive#304. Thanks andpor. **Summary** based on Andrzej's facebookarchive#1223, issue has been there for an incredible 3.5 years. Let's fix this. Pull Request resolved: facebookarchive#2197 Reviewed By: elboman Differential Revision: D18314441 Pulled By: mrkev fbshipit-source-id: 99284101bab838c574341b44b3cfcd935f1dc0e2
Summary: Should fix facebookarchive#304. Thanks andpor. **Summary** based on Andrzej's facebookarchive#1223, issue has been there for an incredible 3.5 years. Let's fix this. Pull Request resolved: facebookarchive#2197 Reviewed By: elboman Differential Revision: D18314441 Pulled By: mrkev fbshipit-source-id: 99284101bab838c574341b44b3cfcd935f1dc0e2
This bug is produced if I click enter with huge text. I added text in editor, then click the enter and cursor moves to the end. https://draftjs.org/. Amount symbols 31560 |
Summary: Should fix facebookarchive/draft-js#304. Thanks andpor. **Summary** based on Andrzej's facebookarchive/draft-js#1223, issue has been there for an incredible 3.5 years. Let's fix this. Pull Request resolved: facebookarchive/draft-js#2197 Reviewed By: elboman Differential Revision: D18314441 Pulled By: mrkev fbshipit-source-id: 99284101bab838c574341b44b3cfcd935f1dc0e2
When you have a big paragraph and you press enter in the middle, instead of keeping the focus in the middle of the page, the editor scrolls all the way to the bottom.
Steps to reproduce:
This doesn't seem to happen consistently all the time, but I've seen it come up enough times on big paragraphs.
The text was updated successfully, but these errors were encountered: