Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Only highlight the currently focussed widget #304

Open
DarkTrick opened this issue Sep 25, 2021 · 8 comments
Open

[FEATURE] Only highlight the currently focussed widget #304

DarkTrick opened this issue Sep 25, 2021 · 8 comments

Comments

@DarkTrick
Copy link
Contributor

>> I can implement this, I just need the go <<

Current situation

There's no differentiation in colors between the states :selected and :selected:focus. This leads to something like this:

Suggestion

  1. Behavior: Differentiate between both states to make it very clear to the user which input currently has focus.
  2. Coloring: <omitted, let's first clear up if the behavior is wanted.>
@DarkTrick
Copy link
Contributor Author

DarkTrick commented Sep 25, 2021

Note: How to Implement

Given, that #303 will be accepted the change is very easy: in gtk-3/_common.scss under %selected_items, the following part

  // don't differentiate between focussed and unfocussed widgets.
  &:focus, &{
    color: $selected_fg_color;
    background-color: $selected_bg_color;
  }

needs to become

  color: $selected_fg_color;
  background-color: $selected_bg_color;

  &:focus {
    color: $selected_focussed_fg_color;
    background-color: $selected_focussed_bg_color;
  }

And - accordingly - the values of the used variables must be adjusted.

@bluesabre
Copy link
Member

At least in the Edge browser, when the URL bar has focus, the page selection is considered inactive (goes grey instead of the highlight color). It probably makes sense for us to do the same.

image

image

@DarkTrick
Copy link
Contributor Author

DarkTrick commented Sep 26, 2021

Thank you for the quick look-over.
Your suggestion would be about a 6-character diff (selected-non-focussed color = selected backdrop color).
Other voices?

@DarkTrick
Copy link
Contributor Author

DarkTrick commented Sep 28, 2021

I came up with these two. I can't decide which to take. I'm not a designer, so some input in coloring would really help :)

image

@ochosi
Copy link
Member

ochosi commented Sep 28, 2021

I'm all for the "easier to implement" version. It's still well-readable and a good improvement over what we have now.

@DarkTrick DarkTrick changed the title [FEATURE] Differentiate colors of :selected and :selected:focus [FEATURE] Only highlight the currently focussed widget Nov 9, 2021
@DarkTrick
Copy link
Contributor Author

DarkTrick commented Nov 9, 2021

Update: This is much more complicated than expected for certain cases.

Question: Is this tolerable?

No, it is not
Is this behavior for mutliselection in a GtkListBox (not TreeView) tolaerable, if everything else works fine in regard of this issue report?
image

Current problem

At the moment, it seems impossible implement it for GtkListBox, because

  1. list (GtkListBox's CSS class) will have no indicator, if one of its children is focused
    AND
  2. CSS does not enable styling of preceding elements (I'm searching here (for general CSS) and here (for a Gtk-specific answer))

This is how a GtkListBox would currently look like with multiselect:
image

How far I've got

General change

This is a diff for the general change to only make focus highlight

@@ -4500,13 +4500,12 @@ headerbar.selection-mode button.titlebutton,
 
 %selected_items {
 
-  // don't differentiate between focussed and unfocussed widgets.
-  &:focus, &{
+  &:focus{
     color: $selected_fg_color;
     background-color: $selected_bg_color;
   }
 
-  &:backdrop {
+  &:backdrop, & {
     color: $backdrop_selected_fg_color;
     background-color: $backdrop_selected_bg_color;
   }
@@ -4516,6 +4515,8 @@ headerbar.selection-mode button.titlebutton,
 
     @if $variant == 'light' { outline-color: transparentize($selected_fg_color, 0.7); }
 
+    &:focus, &{ color: $selected_fg_color; }
+
     &:disabled { color: mix($selected_fg_color, $selected_bg_color, 50%); }
 
     &:backdrop {

Edge-case: Treeview multiselect

This will style treeview properly (difficult because of multiselect):

    treeview:focus > treeview:selected
    {
       background: $selected_bg_color;
    }

Edge-case: Whiskermenu (multiple focused elements)

This will style Whiskermenu properly (in _xfce.scss) (difficult, because whiskermenu kind of has two focused elements at the same time.):

#whiskermenu-window box :selected
{
  color: $selected_fg_color;
  background-color: $selected_bg_color;
}

Edge-case: GtkListBox multiselect

      // 1) focused row itself
      row:focus {
        background: $selected_bg_color;
      }

      // 2) every selected row BELOW the focused row
      row:focus ~ row:selected {
        background: $selected_bg_color;
      }

     // 3) every selected row ABOVE the focused row
     // still searching (see problem description above)

Edge-case GtkLabel (??)

Problem:
Open gtk3-demo, page3, click in treeview in the top left, press tab, [label receives focus and turns blue], mouse-click in treeview again, label stays blue (label should loose the blue background).

Probably easy to solve; I'm still working on GtkListBox atm.

@DarkTrick
Copy link
Contributor Author

DarkTrick commented Nov 12, 2021

GTK3 does not support this feature for all widgets (namely the GtkListBox list box is impossible to solve in GTK3).
GTK4 offers a solution for GtkListBoxes as well (:focus-within).

Question

Is it acceptable to

  • In general only highlight the currently selected item in focus.
  • Only GtkListBoxes are always colored as if they have the focus.

?

Here's an example from gtk3-demo.

image

I know this is an inconsistency, but at least all apps that don't involve GtkListBoxes wore more intuitive that way.

@ochosi
Copy link
Member

ochosi commented Apr 27, 2022

@DarkTrick I wasn't around for a while, if you still wanna fix this a PR would be appreciated! (I can live with the ListBox inconsistency)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants