Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#36460 closed defect (bug) (worksforme)

Unable to break out of code tags in visual mode when using keyboard navigation

Reported by: clorith's profile Clorith Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: Editor Keywords:
Focuses: javascript Cc:


If you've entered the backtick shortcut to add a <code> tag as the last bit of text in the editor, and then use the keyboard to navigate around in the text (say to fix a typo earlier on), going to the end of the document either by keyboard navigation or clicking the end with the mouse puts you inside the code tag and it can't be broken out of unless you hit return to create a new paragraph.

If you create a new paragraph then try to backspace to remove it again you are once more put inside the code tag, the only way to break this is by going into text mode and adding any symbol that isn't a space after the code tag manually.

Change History (2)

#1 @azaozz
8 years ago

  • Milestone 4.5 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

This is not a new bug or a regression. Unfortunately that is how contentEditable behaves in many cases. Happens with all inline elements that are at the end of a block element/paragraph. Pressing Enter/Return is the standard way to "break out".

This is also the main reason TinyMCE has an "element path" at the bottom of the editor, so the user can click/tab to it and choose the "currently selected" element where the caret is.

I realize this behaviour is not ideal, but there is very little we can do to change it. Pretty much all "word processors" behave in this or very similar way. Some would even "maintain" the current formatting, meaning they will insert a <code> tag in the new paragraph created on Enter, and place the caret there. The only way to remove that is by using the Clear formatting button (second row).

Going to close this as worksforme, feel free to reopen if there are better examples of how the editors should behave in this case.

Last edited 8 years ago by azaozz (previous) (diff)

This ticket was mentioned in Slack in #core-editor by clorith. View the logs.

8 years ago

Note: See TracTickets for help on using tickets.