w3c / w3c/edit-context

EditContext needs a way to inform IMEs of vertical writing modes

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

Nobody has claimed this yet.

Dominant language
HTML
Stars
48
Forks
13
PR merge metrics
No merged PRs in 30d

Description

When editing vertical text, IMEs may position themselves differently and may layout their own contents differently.
Browsers (or at least Chromium) notify IMEs when the cursor is currently editing vertical text so that they can make these adjustments.

This isn't currently working in EditContext.

One fix would be to check the computed styles of the EditContext's associated element to determine whether to tell the IME it's in vertical versus horizontal writing mode. This is a bit odd though since EditContext doesn't otherwise rely on the associated element's styles, and making changes to those styles in response to EditContext state changes could be an awkward way of managing this.

Another would be to use the computed style at the current cursor's position (but this doesn't work for <canvas>-based EditContext).

I think the right fix is to add a property on EditContext allowing the author to explicitly set whether the current writing mode is horizontal or vertical.

let editContext = new EditContext();
editContext.writingMode; // default is "horizontal"
editContxt.writingMode = "vertical"; // Now we report to IMEs that vertical text is being edited.

// Or just a boolean:
let editContext = new EditContext();
editContext.isVerticalWritingMode; // default is false
editContext.isVerticalWritingMode = true; // Now we report to IMEs that vertical text is being edited.

Something I'm unsure about is whether this should match the options available to CSS writing-mode: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/writing-mode. I'm not sure whether all of those permutations are relevant to IMEs or if the only thing we need is horizontal versus vertical. Even if only horizontal/vertical is needed, maybe there's still a consistency argument that they should be the same?

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 EditContext associated-element definition and the CSS writing-mode options linked in the issue, then compare the horizontal-versus-vertical and full writing-mode proposals. Done means reaching agreement on the API shape and semantics, including the default, and specifying how the selected mode is reported to IMEs.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, html, javascript
Domain
api, frontend, internationalization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.