Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8647001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:57:25+00:00 2026-06-12T12:57:25+00:00

http://jsfiddle.net/Y7tgx/2/ Firefox handles this better than Chrome does, but neither exactly the way I

  • 0

http://jsfiddle.net/Y7tgx/2/

Firefox handles this better than Chrome does, but neither exactly the way I want. They both lump all adjacent HTML tags together and treat them as one (which I don’t want).

Firefox: when the cursor is left of a tag (or group of adjacent tags) and you press right, the cursor jumps past the first character preceding the tag. Then, if you press left, it goes between the character and the tag. (Same for pressing left then right.)

Chrome: the tag and the first character following it are lumped together. It is impossible to place the cursor between a tag and the following character.

Desired: a tag is treated as a single character with respect to the cursor. If the cursor is to the left of a tag and you press right, it should go to the right of the tag, and vice versa for pressing left.

How can the desired behavior be enforced on the browser?

This is not intended for a WYSIWIG editor. To serve a specific purpose, tags are represented visually in production just as they are in the jsfiddle. Users desire arbitrary control over which element contains the cursor.

b:before, b:after,
i:before, i:after,
p:before, p:after {
    color: blue;
}

b:before {
    content: '<b>';
}

b:after {
    content: '</b>';
}

p:before {
    content: '<p>';
}

p:after {
    content: '</p>';
}

i:before {
    content: '<i>';
}

i:after {
    content: '</i>';
}​

----------

<p contenteditable='true'>regular regular<b>bold</b>regular - 
try moving the cursor to either side of either blue tag.</p>
<p contenteditable='true'>try it in this: regular<b><i>bolditalic</i></b></p>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:57:26+00:00Added an answer on June 12, 2026 at 12:57 pm

    Modifying the code to make sure that characters aren’t skipped would be a reasonable fix, but being able to navigate between adjacent tags or editing tags would be opposed to how browsers treat markup (treating invisible tags as text content). The visual representation of tags should be done as text content in order to do that, and any more magical solution will most likely have to lean on that at some point (so it would be clearer to do it outright). A fairly straightforward approach would be to use something like <span class="tag">&lt;b&gt;</span> and then add JavaScript that attaches to *[contenteditable='true'] span.tag to control the cursor moving over that span as a single unit.

    The conversion to/from would likely be best done using server side code, but otherwise using basic introspection in JavaScript would allow for the needed replacement or supplementing of code (replacement would make editing far easier, but simply adding the additional spans would be less invasive if the element structure is fixed and only the text content is being edited.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://jsfiddle.net/AndyMP/UpLts/1/ This is just an example for illustrative purposes, but what I want to
http://jsfiddle.net/GGsEt/3/ Works on firefox HTML <ul> <li class="lib_undefined"> <span class="hidden_toggle"> <a href="/">Test</a> </span> </li>
http://jsfiddle.net/WTELW/4/ The following works fine on JSFiddle, but doesn't seem to work right in
http://jsfiddle.net/nWqYL/2/embedded/result/ I've been working on fixing some issues with this prototype site. Myself and
http://jsfiddle.net/mJxn4/ This is very odd: I have a few lines of text wrapped in
http://jsfiddle.net/CbL7W/ example of scroll event behavior. I have this script that is working correctly
http://jsfiddle.net/herrturtur/ExWFH/ To try this: click the plus button, double click the newly created name
http://jsfiddle.net/smhz/vFSV2/2/ When i click on edit checkboxes appear but i want when i check
http://jsfiddle.net/yxhzU/1042/ I'm trying to modify this example so that within the top carousel you
http://jsfiddle.net/4UbKe/3/ Please check out the fiddle to see exactly why it doesn't work. I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.