w3c / w3c/editing

Selection updates from Web APIs should scroll to reveal selection in scrollable containers

Open
#526 0 comments 1 reaction 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

Current spec doesn't define whether setting selection through Web APIs should scroll to reveal the selection.

Case: Caret in scrollable container

<div style="width: 200px; height: 50px; overflow: auto;">
  <p>Line 1</p>
  <p>Line 2</p>
  <p id="target">Line 3 - below fold</p>
</div>
selection.collapse(target.firstChild, 5);

Browser behaviors:
Chromium - No scroll, caret not visible
Safari - No scroll, caret not visible
Firefox - Scrolls to reveal caret ✓

Proposed Behaviour

Selection should scroll the closest scrollable ancestor to reveal the selection.

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 with the issue's scrollable-container HTML case and the selection.collapse(target.firstChild, 5) example. Read the selection Web API specification and compare the listed Chromium, Safari, and Firefox behavior. Done means the specification defines whether selection changes scroll the closest scrollable ancestor to reveal the selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.