After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 769876 - GtkGrid, :nth-child not working as expected in rtl, resulting in .linked child widgets visual breakage
GtkGrid, :nth-child not working as expected in rtl, resulting in .linked chil...
Status: RESOLVED DUPLICATE of bug 681660
Product: gtk+
Classification: Platform
Component: Widget: Other
3.22.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-08-14 05:02 UTC by Arnaud B.
Modified: 2018-04-22 19:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot. (52.32 KB, image/png)
2016-08-14 05:02 UTC, Arnaud B.
Details
test case (1.94 KB, text/plain)
2017-03-02 20:36 UTC, Daniel Boles
Details
screenshots of test case in LTR vs RTL modes (405.52 KB, image/png)
2017-03-02 20:37 UTC, Daniel Boles
Details

Description Arnaud B. 2016-08-14 05:02:58 UTC
Created attachment 333260 [details]
Screenshot.

The search bar of dconf-editor uses a “linked” CSS class on a GtkGrid to link a GtkSearchEntry and a GtkButton. Looks like it is broken in languages that are writen right-to-left.
Comment 1 Lapo Calamandrei 2016-08-22 12:28:47 UTC
This is not a theme issue, the :nth-child pseudoclass doesn't work as it should there, try `.linked button:last-child { color: red; }` in the inspector and stare at the button (which should be the :first-child) getting a red arrow. Changing summary to reflect the issue.
Comment 2 Arnaud B. 2016-09-14 23:47:08 UTC
OK, I see, thanks. I solved `dconf-editor` problem using GtkBox ( https://git.gnome.org/browse/dconf-editor/commit/?id=23317f8675422e289bce1e456b69f50de65dd22f ), but I think the issue is a dangerous one as nobody^Wonly a few people test in RTL.
Comment 3 Daniel Boles 2017-03-02 20:33:30 UTC
It seems to me that the problem here is really Box! It applies :last-child to both

 * the FIRST child added to the container
 * the FIRST child in the reading direction

Grid correctly selects the _last_ for both points, but this does not agree with whatever the theme CSS is trying to do.
Comment 4 Daniel Boles 2017-03-02 20:36:18 UTC
Created attachment 347097 [details]
test case

run, then use the inspector to change the text direction
Comment 5 Daniel Boles 2017-03-02 20:37:35 UTC
Created attachment 347098 [details]
screenshots of test case in LTR vs RTL modes
Comment 6 Daniel Boles 2017-08-24 10:57:30 UTC
*** Bug 772817 has been marked as a duplicate of this bug. ***
Comment 7 Daniel Boles 2018-04-22 16:25:03 UTC
GtkBox is behaving as documented here: gtkbox.c:
 * In horizontal orientation, the nodes of the children are always arranged
 * from left to right. So :first-child will always select the leftmost child,
 * regardless of text direction.

GtkGrid does not document how it handles such cases one way or another.
Comment 8 Daniel Boles 2018-04-22 17:44:00 UTC
I'm going to attach a patch at Bug 772817 for GtkPathBar, which is another widget that flips the children in RTL and thus needs TLC. That may end up being adaptable to other cases, at least while the widgets themselves refuse to handle the child order like GtkBox, as Bug 681660 indicated GtkGrid won't do (for now).
Comment 9 Daniel Boles 2018-04-22 18:59:56 UTC
(In reply to Daniel Boles from comment #7)
> GtkBox is behaving as documented here: gtkbox.c:
>  * In horizontal orientation, the nodes of the children are always arranged
>  * from left to right. So :first-child will always select the leftmost child,
>  * regardless of text direction.

Note that for master, Benjamin and Timm want this to stop, but it's not quite trivial on the theme side:

> Company:
>   dboles: when you do this work, can you make box also not flip on RTL
>           anymore?
> 
> dboles:
>   I was thinking that might be the correct approach for master
>   but in gtk-3-22 it'll have to be some awful workaround like that patch
> 
> Company:
>   yes, baedert and me complain about it all the time
>   but neither of us wants to fix the theme...
>
> dboles:
>   Company: it's hopefully not that difficult - at least, fixing that one case
>            on gtk-3-22 seemed easy enough and shouldn't(!?!) break anything
>            else
>   Company: then we'd probably just have .linked assume no flipping, converse
>            to what it currently does, and avoid the need for any
>            %linked_rtlflip or whatever
>
> Company:
>   dboles: yeah - but there might be more cases that use boxes than just
>           .linked
>   dboles: so one would probably need to look through the theme and figure our
>           if all the cases of :first-child/:last-child still work
>   dboles: like, I have no idea what happens with spinbuttons or comboboxes
Comment 10 Daniel Boles 2018-04-22 19:31:41 UTC

*** This bug has been marked as a duplicate of bug 681660 ***