Bug 187848 - [GTK] Cursor movement with anchors styled display: inline-block; word-break: normal; broken
Summary: [GTK] Cursor movement with anchors styled display: inline-block; word-break: ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-20 02:18 PDT by Milan Crha
Modified: 2021-03-09 04:48 PST (History)
3 users (show)

See Also:


Attachments
a.html (2.19 KB, text/html)
2018-07-20 02:18 PDT, Milan Crha
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Milan Crha 2018-07-20 02:18:28 PDT
Created attachment 345437 [details]
a.html

Open the attached HTML file in the MiniBrowser with the editor mode on:

   $ /usr/libexec/webkit2gtk-4.0/MiniBrowser --editor-mode a.html

Then use arrows to move the cursor within the text, specifically:

I) holding the Arrow-Down stops at the start of the anchor of the second paragraph and doesn't move further.

II) when have cursor at the place of I), press Arrow-Right 5 times; then:
II-a) press Home key, the cursor moves at the beginning of the anchor; press the Home the second time, then it moves to the line beginning;
II-b) press Arrow-Up, the cursor moves to the right, not up; pressing Arrow-Up again doesn't move the cursor, but pressing Arrow-Left three times and then Arrow-Up moves cursor to the right again, to a different position.

The anchors is styled as:

  a {
     display: inline-block; 
     word-break: normal; 
  }

which obviously confuses WebKitGTK+. The idea is to not wrap anchors, even they are inside a div styled as:

  style="width: 71ch;"

I didn't find any better trick to stop wrapping of the anchors. I didn't feel to split the DOM structure, because it can be a deep tree of elements.

If you have any better suggestion for a workaround of this WebKitGTK+ bug, then I'll be happy to change the code for the time being. Downstream bug:
https://gitlab.gnome.org/GNOME/evolution/issues/71
Comment 1 Milan Crha 2021-03-09 04:48:27 PST
A workaround, which works with 2.30.5, is to use this style instead:

   a {
     word-wrap: normal;
     word-break: keep-all; 
   }