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

Inline boundary and arrow navigation edge case #5095

Closed
afercia opened this issue Feb 16, 2018 · 8 comments
Closed

Inline boundary and arrow navigation edge case #5095

afercia opened this issue Feb 16, 2018 · 8 comments
Assignees
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Type] Bug An existing feature does not function as intended
Milestone

Comments

@afercia
Copy link
Contributor

afercia commented Feb 16, 2018

Tested on current master.

In the current demo content, there's a paragraph that contains italic text:

screen shot 2018-02-16 at 09 29 04

TinyMCE adds "boundaries" to the italic text so to actually exit the boundary, you have to move the caret using the right arrow key. At that point, arrows navigation through blocks kicks in and the caret moves to the following block.

There's no way to exit the boundary not even using the mouse. Pressing the spacebar doesn't work, as you're still inside the boundary.

The only way I've found to exit the boundary and start typing not italic text is to press the right arrow (this brings me in the following block) then press the left arrow (this brings me back to the paragraph block, outside of the boundary).

Wondering what the best option would be in this case. I'd agree it's an edge case but I guess it won't be so uncommon that a block ends with some link, italic, or bold text.

@mtias
Copy link
Member

mtias commented Mar 6, 2018

Sounds like we need to update edge-detection to account for boundaries. cc @mcsf @iseulde

@mtias mtias added [Component] TinyMCE [Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... labels Mar 6, 2018
@afercia
Copy link
Contributor Author

afercia commented Mar 8, 2018

See also #1246.

@ZebulanStanphill
Copy link
Member

ZebulanStanphill commented Apr 12, 2018

As of Gutenberg 2.6, pressing right arrow allows you to exit a formatting boundary (e.g. links or italic text) without moving to the next block. I think this issue can be closed now as the problem appears to be fixed.

EDIT: Nevermind, I just found out that the issue is still happening. It only happens in some situations, though. I am not sure what exactly causes the issue to happen or not, though. 😕

@afercia
Copy link
Contributor Author

afercia commented Apr 12, 2018

Yeah I still can reproduce on current trunk. With the caret at the end of a boundary, users should be able to press the right arrow key to exit the boundary. So in this situation (see below):

screen shot 2018-04-12 at 10 36 01

I should just be able to press right arrow, exit the italic boundary, and keep typing in the current block. Instead, caret goes to the following bock.

@mtias mtias added this to the Merge Proposal: Editor milestone Apr 12, 2018
@ellatrix ellatrix self-assigned this Apr 13, 2018
@ellatrix
Copy link
Member

To be honest I see no easy solution here. The edge detection is handled in writing flow, which receives the keydown event too late. TinyMCE will already have inserted the zero width space at the very end of the editor, so it's considered the edge. Checking for the zero width space here is no option because then we're blocking caret movement entirely. Some possibility would be to check for a second time with the same node but that would be a very ugly fix.

@ellatrix
Copy link
Member

Also placing the caret back is broken in some cases. It will put it inside the boundary if there's no zero width space outside the boundary already, so it doesn't always place it at the edge.

@ellatrix ellatrix added the [Type] Bug An existing feature does not function as intended label Apr 23, 2018
@ellatrix
Copy link
Member

Unassigning for now as I don't have a solution for this atm.

@aduth
Copy link
Member

aduth commented Jun 26, 2018

Possibly related:

  1. Navigate to Posts > Add New
  2. Add new paragraph
  3. Cmd+B to bold
  4. Enter some text
  5. Press enter

Expected: New paragraph added after, caret placed at beginning of new paragraph.
Actual: New paragraph added after, caret stays within the inline boundary.

I'm hoping to be able to revive (at least parts of) #6467 and/or #6712 which should address some of the issues noted here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Rich Text Related to the Rich Text component that allows developers to render a contenteditable [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants