Skip to content

Fix multi-select flickering#1024

Merged
ellatrix merged 1 commit intomasterfrom
fix/multi-select-flicker
Jun 6, 2017
Merged

Fix multi-select flickering#1024
ellatrix merged 1 commit intomasterfrom
fix/multi-select-flicker

Conversation

@ellatrix
Copy link
Member

@ellatrix ellatrix commented Jun 5, 2017

To reproduce the issue, try to start selecting a block containing an Editable region, but not from inside that region, then move up or down to multi-select. The state will bounce between having no multi-selection (as it toggles the selected block) and having multi-selection (as you move the mouse). This results in the flickering selection colour.

I'm still not sure what is causing the multiple set focus calls in the scenario above, while not when starting from inside the Editable...

@ellatrix
Copy link
Member Author

ellatrix commented Jun 5, 2017

Additionally, moving up and down a few times seems to end the flicker, so I'm not sure what exactly is causing it to stop...

@ellatrix
Copy link
Member Author

ellatrix commented Jun 5, 2017

Hm, I even with this patch, I still get the flicker when starting in a quote, between the text and citation.

@ellatrix
Copy link
Member Author

ellatrix commented Jun 5, 2017

Checking out the commit before multi-select was added: If I start selection in between the quoted text and citation, I can also see that focus is continuously called on the editable element, causing the caret to stay visible instead of flicker.

@ellatrix ellatrix force-pushed the fix/multi-select-flicker branch from fa5e7be to e563579 Compare June 5, 2017 17:34
@ellatrix
Copy link
Member Author

ellatrix commented Jun 5, 2017

Actually it just looks like there is an onFocus call too much. The patch also fixes #1005.

@ellatrix ellatrix force-pushed the fix/multi-select-flicker branch 2 times, most recently from 3674a4a to 34fe5a4 Compare June 5, 2017 17:40
@ellatrix ellatrix requested review from aduth and youknowriad June 5, 2017 17:41
@ellatrix ellatrix force-pushed the fix/multi-select-flicker branch from 34fe5a4 to 5330671 Compare June 5, 2017 21:13
@ellatrix
Copy link
Member Author

ellatrix commented Jun 5, 2017

Hm, we can't just take this away. Additionally, I've moved the callback in the wrong place when merging multi-select.

@ellatrix ellatrix removed request for aduth and youknowriad June 5, 2017 22:04
@ellatrix ellatrix force-pushed the fix/multi-select-flicker branch from 5330671 to dfbfbc8 Compare June 5, 2017 22:25
@ellatrix ellatrix requested review from aduth and youknowriad June 5, 2017 22:26
@jasmussen
Copy link
Contributor

Flickering seems much less intermittent in this branch, that's great.

The selection seems a little bit sticky though, hard to explain, but it feels like sometimes you select a few blocks, then deselect, scroll, and then sometimes the blocks are selected again.

Also managed to get a white screen of death and this error in the console:

screen shot 2017-06-06 at 10 06 33

@youknowriad
Copy link
Contributor

This works great for me, I can't reproduce the error above or the sticky selection myself.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we merge into a single if?

Copy link
Member Author

@ellatrix ellatrix Jun 6, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I should use different techniques to indent/wrap. :D

@ellatrix
Copy link
Member Author

ellatrix commented Jun 6, 2017

@jasmussen Could you post the error without minified JS?

Regarding the "sticky" thing, I know what you mean, but it is unrelated to this PR. What you mean is that the selection does not adjust on scroll, but only on mouse move, right? This is because browsers do not fire mouse move events on scroll as the pointer is staying in the same position. I'll attempt to fix this in a separate PR, but it's not trivial.

@ellatrix
Copy link
Member Author

ellatrix commented Jun 6, 2017

Flickering seems much less intermittent in this branch, that's great.

Do you mean that you still see flicker?

@ellatrix ellatrix force-pushed the fix/multi-select-flicker branch from dfbfbc8 to 8b5e765 Compare June 6, 2017 08:51
@ellatrix
Copy link
Member Author

ellatrix commented Jun 6, 2017

Just to clarify, this branch should fix:

  • Multi-select flickering (see above).
  • Horizontal rule selection (cannot select on master).
  • Input and text area that cannot be focussed immediately (Inputs within blocks can't be focused immediately #1005).
  • Tabbing into block without inputs (focus on block wrapper did not select block).

@ellatrix ellatrix requested a review from youknowriad June 6, 2017 08:55
@ellatrix
Copy link
Member Author

ellatrix commented Jun 6, 2017

For the last point, try e.g. tabbing into a YouTube block. It will not select on master, but should here.

@jasmussen
Copy link
Contributor

I couldn't reproduce the error, but got a different one. But I think I narrowed down the selection issue I was having. I think that if you start selecting, then drag outside of the viewport, release the mouse, and then move it inside again, you're still selecting blocks. Which gets a little extra weird when you start selecting anew.

I recorded a video to showcase, but it's soundless so it's a bit hard to see when I click to deselect. But there should be a circle indicator around the arrow when I click:

https://cloudup.com/cx8gXwAMd94

@ellatrix
Copy link
Member Author

ellatrix commented Jun 6, 2017

Okay, that looks like a combination of the issue I described above, and not having mouse move event handlers outside the blocks. The selection issue when moving outside the window is also valid. Could we please attempt to fix these in a separate issues?

@jasmussen
Copy link
Contributor

Could we please attempt to fix these in a separate issues?

Absolutely! It's a vast improvement as is!

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're clear from the JS error, Let's 🚢 this

@ellatrix
Copy link
Member Author

ellatrix commented Jun 6, 2017

I couldn't reproduce the error, but got a different one.

@jasmussen Could you share what the other error was?

@jasmussen
Copy link
Contributor

#1024 (comment)

I can't share more than that screenshot I took in #1024 (comment). It could be just some ghost data from me switching branches and reloading fast.

@ellatrix ellatrix merged commit 3f65f3c into master Jun 6, 2017
@ellatrix ellatrix deleted the fix/multi-select-flicker branch June 6, 2017 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants