w3c / w3c/editing

Valid text element declaration for rich text editing caret accessibility

Open
#481 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
202
Forks
43
PR merge metrics
No merged PRs in 30d

Description

I'm the developer of the JAB Creations web platform which has a rich text editor called the Rich Editor. I use very minimal HTML and like most web developers and designers dislike pixels and spacing added by visual formatting by line break in structural HTML (e.g. header, menu, footer, main, etc) to be annoying. In my Rich Editor I disallow text to be added to what I consider non-text elements. Yes, I know many people love putting text in structural elements like div elements however the context and semantics are lost.

I think it would be valuable for websites with rich text editing to have the ability to define (on their own terms for those who just have to have div text) an array of what they consider valid text elements. This would help greatly improve keyboard caret accessibility with the browsers knowing which elements may and absolutely should not move the keyboard caret to while navigating via Tab or arrow keys in example. That way the HTML generated would be vastly more consistent between rendering engines.

An exhaustive example from my platform's JavaScript elements_array_text() function:

<div contenteditable="true" validtextelements="a,abbr,acronym,area,bdi,bdo,cite,code,data,datalist,dd,del,dfn,dt,em,ins,kbd,label,li,map,mark,p,pre,q,rb,rbc,rp,rt,rtc,ruby,s,sam,small,span,strong,style,sub,sup,textarea,time,td,th,tt,u,var">
<p></p>
</div>

This should please everyone since there will be someone somewhere that insists on putting text in divs; they can just add whatever elements to the comma delimited array.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the proposed validtextelements attribute and the caret-navigation accessibility problem described in the issue. Define the scope and browser-editing behavior before implementation; done would require an agreed specification for declaring valid text elements and evidence that caret navigation is improved consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
accessibility, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.