-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
iOS: Prevent accidental block hover #3139
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3139 +/- ##
==========================================
- Coverage 33.81% 33.78% -0.03%
==========================================
Files 250 250
Lines 6734 6739 +5
Branches 1218 1218
==========================================
Hits 2277 2277
- Misses 3763 3768 +5
Partials 694 694
Continue to review full report at Codecov.
|
With respect to the keyboard disappearing on enter, we've found a few things that might be helpful: a) it happens when a block node is being split. You can replicate it easily on a new post by pressing enter halfway through a paragraph block. in in
As you can probably infer, a lot of this is empirically determined, rather than read from a spec somewhere. If you know where the spec is, though, please tell us :) So in summary, if you remove both the focus and the blur line, the keyboard stays open and the block is correctly focused. I'm not suggesting that's the solution at all ... just providing some information that might help explain what's going on. I tried to replicate the issue in a fiddle outside of Gutenberg, but had no luck. It probably depends on when React is firing focus and blur on these nodes. The sequence seems to be: |
editor/layout/style.scss
Outdated
.mobile .editor-layout__editor { | ||
overflow-y: scroll; | ||
-webkit-overflow-scrolling: touch; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MDN seems very wary of using -webkit-overflow-scrolling
. Are we safe? Is there a risk of targeting unwanted platforms where this could have a bad impact? We could target this to iOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcsf only webkit should interpret this from the vendor prefix and body will have the .mobile
class on for mobile devices? Have tested on iPad and Nexus tablet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only webkit should interpret this
Indeed, but my concern was whether this could affect non-iOS WebKit agents negatively. However, if you've tested on a Nexus and feel confident about this, I can withdraw my question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we really target .mobile
here? What is the connection between the two? Can we not just add it to .editor-layout__editor
?
Thanks for the comprehensive comment, @ephox-mogran. @tg-ephox, could you provide full testing instructions, as well as specifics on what this should be fixing? I'm not able to repro some of the problems mentioned in the parent issue, at least not on an iPhone—can grab an iPad for a fuller review. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good to go as a smaller PR. I notice the In Progress label is present, but we can defer any other work to a new PR.
For the scrolling, there was also #2860. |
Since #2860 is slightly broader in reach and has been previously tested and approved, let's rebase and merge that one, and we can amend this one to only deal with the hover issue. |
@@ -72,6 +72,8 @@ class VisualEditorBlock extends Component { | |||
this.onKeyDown = this.onKeyDown.bind( this ); | |||
this.onBlockError = this.onBlockError.bind( this ); | |||
this.insertBlocksAfter = this.insertBlocksAfter.bind( this ); | |||
this.onTouchStart = this.onTouchStart.bind( this ); | |||
this.onClick = this.onClick.bind( this ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the diff between touch start and click here? Might it be better stick to touch events entirely to set this.hadTouchStart
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried onTouchEnd but it fires too soon it needs to be after mousemove
It would be nice to have some inline comments for this browser fix. I will test in just a bit on a device. |
This works for me on iOS. I'm surprised mouse enter/move fire there. :/ |
This PR closed #2601 while only one non related issue was fixed. |
Description
Fixes #2601
How Has This Been Tested?
Manual testing on device
Screenshots (jpeg or gifs if applicable):
Types of changes
Bug fix
Checklist: