Page MenuHomePhabricator

Inspector placement can be thrown off by subscript text
Closed, ResolvedPublic

Assigned To
Authored By
Esanders
Jul 15 2025, 10:57 AM
Referenced Files
F64564836: image.png
Jul 15 2025, 10:57 AM
F64564804: image.png
Jul 15 2025, 10:57 AM
F64564627: image.png
Jul 15 2025, 10:57 AM
F64564576: image.png
Jul 15 2025, 10:57 AM
Subscribers

Description

The desktop context will place itself in the middle of a selection's bounding box, if that middle also lies with the start and end rects. start/end rects are calculated as the union of rectangles which share a top/bottom border with the bounding rectangle.

SimpleComplex
image.png (145×419 px, 17 KB)
image.png (169×524 px, 35 KB)

The middle of bounding box isn't within the start/end rects, we place the context at the end-most edge of the end rect:

image.png (177×559 px, 32 KB)

If the text contains subscript, that subscript gets its own rect which will have a lower bottom border than the rest of the line, and so will be consider the end rect on its own. This leads to a confusing context placement:

image.png (177×559 px, 33 KB)

This is very much an edge case, but highlights a limitation in the selection rectangle API, which may be more prominent is some future use case.

One possible solution would be to merge in any rects which vertically overlap.

Event Timeline

Esanders renamed this task from Inspector placement can be thrown off by subscript text to Inspector placement can be thrown off by supserscript/subscript text.Jul 15 2025, 11:22 AM
Esanders renamed this task from Inspector placement can be thrown off by supserscript/subscript text to Inspector placement can be thrown off by subscript text.

Change #1169639 had a related patch set uploaded (by Esanders; author: Esanders):

[VisualEditor/VisualEditor@master] ve.getStartAndEndRects: Merge overlapping start/end rects

https://gerrit.wikimedia.org/r/1169639

Change #1169639 merged by jenkins-bot:

[VisualEditor/VisualEditor@master] ve.getStartAndEndRects: Merge overlapping start/end rects

https://gerrit.wikimedia.org/r/1169639

Change #1174480 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (276febcab)

https://gerrit.wikimedia.org/r/1174480

Change #1174391 had a related patch set uploaded (by Esanders; author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (276febcab)

https://gerrit.wikimedia.org/r/1174391

Change #1174480 abandoned by Esanders:

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (276febcab)

Reason:

I9f2a08d1c98420197aea2c38fa0e4a0c6d099c66

https://gerrit.wikimedia.org/r/1174480

Change #1174391 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (307c0c15a)

https://gerrit.wikimedia.org/r/1174391

Esanders added a project: Editing QA.
Esanders moved this task from Inbox to Low Priority on the Editing QA board.
EAkinloose edited projects, added Verified; removed Editing QA.