Bug 562043 - [Win32][Dark Theme] Tables have no selection nor hover highlights
Summary: [Win32][Dark Theme] Tables have no selection nor hover highlights
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.16   Edit
Hardware: All Windows 10
: P3 major (vote)
Target Milestone: 4.17 M3   Edit
Assignee: Alexandr Miloslavskiy CLA
QA Contact:
URL:
Whiteboard:
Keywords: usability
: 563829 564242 564538 564822 565605 (view as bug list)
Depends on:
Blocks: 564960 562454 563540
  Show dependency tree
 
Reported: 2020-04-12 06:52 EDT by Pierre-Yves Bigourdan CLA
Modified: 2021-10-13 16:12 EDT (History)
13 users (show)

See Also:


Attachments
Find actions Dark theme on Windows (39.18 KB, image/png)
2020-04-12 06:52 EDT, Pierre-Yves Bigourdan CLA
no flags Details
No select nor hover (40.04 KB, image/png)
2020-05-16 12:28 EDT, Pierre-Yves Bigourdan CLA
no flags Details
Highlights without theming (39.88 KB, image/png)
2020-05-17 05:40 EDT, Pierre-Yves Bigourdan CLA
no flags Details
HoverHelp wit dark mode (9.73 KB, image/png)
2020-05-17 13:22 EDT, Pierre-Yves Bigourdan CLA
no flags Details
Simple dark SWT Table and Tree (2.27 KB, application/octet-stream)
2020-05-18 09:22 EDT, Alexandr Miloslavskiy CLA
no flags Details
Simple dark SWT Table and Tree (2.21 KB, application/octet-stream)
2020-05-18 11:06 EDT, Alexandr Miloslavskiy CLA
no flags Details
Screenshot with fix from Alexandr (59.33 KB, image/png)
2020-08-13 08:54 EDT, Lars Vogel CLA
no flags Details
Screenshot for code completion with fix (37.05 KB, image/png)
2020-08-13 08:57 EDT, Lars Vogel CLA
no flags Details
Dark menus in Eclipse on Windows (32.07 KB, image/png)
2020-08-19 13:03 EDT, Pierre-Yves Bigourdan CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pierre-Yves Bigourdan CLA 2020-04-12 06:52:12 EDT
Created attachment 282420 [details]
Find actions Dark theme on Windows

The hover colour for entries in the Find Actions windows is blue on Windows. This looks a bit odd IMHO and is inconsistent with the hover effect in the project explorer, preferences and other trees and tables throughout the UI.
Comment 1 Pierre-Yves Bigourdan CLA 2020-05-16 12:28:41 EDT
Created attachment 282893 [details]
No select nor hover

The problem seem to have gotten *much* worse in 4.16. I've installed the latest Platform SDK nightly build, Find Actions has lost both selection highlights and hover highlights.

In the attached screenshot, I've pressed the down key 4 times (pressing Enter would open the Debug View), and I'm hovering over an element in the middle of the Find Actions list. There is no longer any visual indication of either of these.
Comment 2 Pierre-Yves Bigourdan CLA 2020-05-16 12:39:34 EDT
(In reply to Pierre-Yves B. from comment #1)
> (pressing Enter would open the Debug View)

*Bookmarks view, was reading text from below :)
Comment 3 Andrey Loskutov CLA 2020-05-16 15:35:06 EDT
CSS theming is in Platform UI, not SWT.
Comment 4 Lars Vogel CLA 2020-05-17 05:18:55 EDT
Piere-Yves, how does it look with theming disabled? As we removed the custom drawing we should see SWT standard.
Comment 5 Pierre-Yves Bigourdan CLA 2020-05-17 05:40:43 EDT
Created attachment 282897 [details]
Highlights without theming

Without theming, you can see both selection and hover highlights.

My gut feeling: there may be a bug with the SWT dark mode for tables on Windows (hence why I put the bug in Platform SWT, Andrey). Not sure when this bug was introduced. With the custom selection and hover CSS styling that was previously applied to tables on Windows in 4.15, the custom selection highlight was visible as expected (though the hover looked ugly, as described in my initial message in this bug report).
Comment 6 Lars Vogel CLA 2020-05-17 06:36:42 EDT
Pierre-Yves, please try to reproduce with a SWT only snippet and post it here. Adding Alexandr, he may be able to give clues what is wrong here.
Comment 7 Pierre-Yves Bigourdan CLA 2020-05-17 13:22:28 EDT
Created attachment 282901 [details]
HoverHelp wit dark mode

(In reply to Lars Vogel from comment #6)
> Pierre-Yves, please try to reproduce with a SWT only snippet and post it
> here. Adding Alexandr, he may be able to give clues what is wrong here.

Not entirely sure how to programmatically enable the dark mode. Would be worth mentioning in the N&N, even if it's still experimental.

After digging through some Platform UI code I found "OS.setTheme", I'm assuming that switch is sufficient. Keeping that in mind, I launched the HoverHelp.java example in the SWT codebase after modifying it to add OS.setTheme(true). See attachment for the visual result.

On the left you have a table. The selection is blue with a doted border. There is no hover highlight.

On the right, you have a tree. The first dark line is selected, the second one is hovered over.

On top, you have a few tool items. I didn't manage to capture this is the same screenshot, but there is yet a different selection and hover effect, different from the tree and table ones.

When the various elements become inactive, there is also another set of inconsistent effects which I haven't described here.

You can also observe these behaviours in the IDE's various preference pages of the latest nightly build.

In addition to the Find Actions problem and the other discrepancies I've just described, I'm getting other worrying side effects with the new dark theme capabilities, for example Bug 563270. Unless I'm the only one facing these issues, given how close it is to 4.16 M3 the various Eclipse leads should probably start a conversation on the way forward :)
Comment 8 Alexandr Miloslavskiy CLA 2020-05-18 09:22:02 EDT
Created attachment 282910 [details]
Simple dark SWT Table and Tree
Comment 9 Alexandr Miloslavskiy CLA 2020-05-18 09:24:43 EDT
(In reply to Pierre-Yves B. from comment #1)
> The problem seem to have gotten *much* worse in 4.16. I've installed the
> latest Platform SDK nightly build, Find Actions has lost both selection
> highlights and hover highlights.

I have used the SWT snippet posted above and it has both selection and hover highlights. My conclusion is that problem occurs on Eclipse side, which is outside my scope.

> Not entirely sure how to programmatically enable the dark mode. Would be
> worth mentioning in the N&N, even if it's still experimental.

Yes, N&N is pending.

> On the left you have a table. The selection is blue with a doted border.
> There is no hover highlight.
> 
> On the right, you have a tree. The first dark line is selected, the second
> one is hovered over.
> 
> On top, you have a few tool items. I didn't manage to capture this is the
> same screenshot, but there is yet a different selection and hover effect,
> different from the tree and table ones.

Is there a problem?
Comment 10 Alexandr Miloslavskiy CLA 2020-05-18 09:37:59 EDT
Oops, I forgot `OS.setTheme(true)` in my snippet. Indeed, with it, Table has different selection color and no hover highlight.
Comment 11 Alexandr Miloslavskiy CLA 2020-05-18 11:06:53 EDT
Created attachment 282911 [details]
Simple dark SWT Table and Tree
Comment 12 Alexandr Miloslavskiy CLA 2020-05-18 11:14:28 EDT
In order to get dark scrollbars, SWT requests "DarkMode_Explorer" theme which has dark scrollbars.

"DarkMode_Explorer" is partially implemented Windows theme. It has "DarkMode_Explorer::TreeView" which alters Tree to be better compatible with dark theme. But it doesn't have "DarkMode_Explorer::ListView" yet. ListView is native control SWT uses for Table.

At the same time, SWT prefers to use "Explorer::ListView" over "ListView". "Explorer::ListView" is newer explorer-style theme. "ListView" is the default theme that most native applications use. It doesn't have hover highlight.

So, when SWT requests "DarkMode_Explorer" theme, Windows can't find an entry for "DarkMode_Explorer::ListView" and defaults to classic "ListView".

This is an unfortunate limitation of current dark scrollbars approach. Let's hope that Microsoft will extend their dark theme soon.
Comment 13 Alexandr Miloslavskiy CLA 2020-05-18 11:15:18 EDT
In any case, selected item shall always be visible. If it's not, that's an Eclipse side issue, because SWT snippet doesn't have this problem.
Comment 14 Alexandr Miloslavskiy CLA 2020-05-18 11:19:02 EDT
Table's hover color issue could probably be solved by overriding it with Eclipse CSS theming. Lars would know better than me.
Comment 15 Lars Vogel CLA 2020-05-18 11:57:39 EDT
(In reply to Alexandr Miloslavskiy from comment #14)
> Table's hover color issue could probably be solved by overriding it with
> Eclipse CSS theming. Lars would know better than me.

No, we retired our custom drawing on table as it was causing blurry text. So we rely on "pure" SWT.
Comment 16 Pierre-Yves Bigourdan CLA 2020-05-23 13:41:50 EDT
Thanks for all the info Alexandr!

My first idea to help debugging this was to use the CSS Spy tool to have a quick overview of how Find Actions is built UI-wise and compare the styling, classes and SWT bits with other tables that don't have this problem. Unfortunately, CSS Spy doesn't seem to work on popups and other dialogs that are not part of the main IDE shell (e.g. preferences dialog). Any way to trick CSS Spy to display more information?
Comment 17 Lars Vogel CLA 2020-05-23 13:59:33 EDT
I think you can use plugin spy to see the class. Alt+Shift+F1
Comment 18 Pierre-Yves Bigourdan CLA 2020-05-23 16:08:02 EDT
Spotted the following message from Brian de Alwis in the mailing list archive (https://www.eclipse.org/lists/platform-ui-dev/msg07916.html):
"The CSS Spy lost that ability when we moved to the unified dialog.  But I missed that ability too, and hacked it up to allow opening the CSS Spy from a dialog too.  I'll clean it up and push it up."

Brian, do you still have that code somewhere? Would be handy to get that functionality fixed in the CSS spy :)
Comment 19 Lars Vogel CLA 2020-06-02 11:46:42 EDT
*** Bug 563829 has been marked as a duplicate of this bug. ***
Comment 20 Pierre-Yves Bigourdan CLA 2020-06-02 11:56:03 EDT
(In reply to Lars Vogel from comment #19)
> *** Bug 563829 has been marked as a duplicate of this bug. ***

Probably the same cause, though this bug here was about find actions initially, not content assist. Maybe worth renaming it to "Tables have no selection or hover highlights".
Comment 21 Lars Vogel CLA 2020-06-02 12:01:45 EDT
(In reply to Pierre-Yves B. from comment #20)
> Maybe worth renaming it to "Tables have no
> selection or hover highlights".

+1, please go ahead.
Comment 22 Gayan Perera CLA 2020-06-03 04:52:47 EDT
For me with this bug its really hard to use the IDE is dark mode. Specially the content assist. I have switch back to light mode because of this bug 😕
Comment 23 Lars Vogel CLA 2020-06-12 08:12:00 EDT
*** Bug 564242 has been marked as a duplicate of this bug. ***
Comment 24 Lars Vogel CLA 2020-06-22 09:33:55 EDT
(In reply to Alexandr Miloslavskiy from comment #12)
> In order to get dark scrollbars, SWT requests "DarkMode_Explorer" theme
> which has dark scrollbars.
> 
> "DarkMode_Explorer" is partially implemented Windows theme. It has
> "DarkMode_Explorer::TreeView" which alters Tree to be better compatible with
> dark theme. But it doesn't have "DarkMode_Explorer::ListView" yet. ListView
> is native control SWT uses for Table.
> 
> At the same time, SWT prefers to use "Explorer::ListView" over "ListView".
> "Explorer::ListView" is newer explorer-style theme. "ListView" is the
> default theme that most native applications use. It doesn't have hover
> highlight.
> 
> So, when SWT requests "DarkMode_Explorer" theme, Windows can't find an entry
> for "DarkMode_Explorer::ListView" and defaults to classic "ListView".
> 
> This is an unfortunate limitation of current dark scrollbars approach. Let's
> hope that Microsoft will extend their dark theme soon.

Would it be possible to fix this in SWT win without changes on the Microsoft side?
Comment 25 Lars Vogel CLA 2020-06-22 09:34:19 EDT
*** Bug 564538 has been marked as a duplicate of this bug. ***
Comment 26 Gayan Perera CLA 2020-07-03 08:35:15 EDT
Hi any updates or workarounds for using dark theme with selections ?
Comment 27 Pierre-Yves Bigourdan CLA 2020-07-03 13:18:11 EDT
I did notice one thing whilst experimenting: I tried a completely empty theme (i.e. a CSS sheet without anything inside), but gave said theme an ID containing the keyword "dark" so that the code in org.eclipse.e4.ui.swt.internal.win32.DarkThemeProcessor calls OS.setTheme(true) automatically when enabling it. The bug still occurred, which indicates that there is no problem with the CSS, but rather a problem with how OS.setTheme(true) is impacting those table popups.
Comment 28 Alexandr Miloslavskiy CLA 2020-07-03 14:11:54 EDT
I understand that this bug deals with two problems:

1) No hover highlight in Table in Dark theme.
   I confirm that this happens even with bare SWT with no Eclipse, and as per
   Comment 12, this is an unfortunate side effect of dark scrollbars. It could
   possibly be helped with partial owner drawing. I consider this to be a cosmetic
   problem, which we don't really care about in our product, so I'm not very 
   interested in solving it.

2) No highlight for selected item in Table
   Comment 11 contains a snippet with a Dark Table, and the problem does not
   reproduce. I therefore understand that this is an Eclipse problem and now an
   SWT problem. I could look into this, but I will need one of two:

   a) Reproducing snippet. That would be best.
   b) Steps needed to see it in Eclipse. Remember that I'm not an Eclipse user
      and I barely know anything about it.
Comment 29 Gayan Perera CLA 2020-07-03 14:52:05 EDT
(In reply to Alexandr Miloslavskiy from comment #28)
> I understand that this bug deals with two problems:
> 
> 1) No hover highlight in Table in Dark theme.
>    I confirm that this happens even with bare SWT with no Eclipse, and as per
>    Comment 12, this is an unfortunate side effect of dark scrollbars. It
> could
>    possibly be helped with partial owner drawing. I consider this to be a
> cosmetic
>    problem, which we don't really care about in our product, so I'm not very 
>    interested in solving it.
> 
> 2) No highlight for selected item in Table
>    Comment 11 contains a snippet with a Dark Table, and the problem does not
>    reproduce. I therefore understand that this is an Eclipse problem and now
> an
>    SWT problem. I could look into this, but I will need one of two:
> 
>    a) Reproducing snippet. That would be best.
>    b) Steps needed to see it in Eclipse. Remember that I'm not an Eclipse
> user
>       and I barely know anything about it.

I can help with the steps,

1. Run Eclipse with workspace
2. Press CTRL+3
3. This will show a popup with a table which is the "Find Action" view
4. In the search are type "Git" for example.

Now press the down arrow key to highlight items in the table. You can see that the selection is not drawn with the selection background color.
Comment 30 Alexandr Miloslavskiy CLA 2020-07-06 16:41:19 EDT
Thanks for the steps. It does reproduce for me.

Studying it, I found that changing `Table#explorerTheme` to false in dark theme fixes the problem. And it actually needs to be false as per Comment 12, because Win10 doesn't currently have a dark theme entry for ListView, so trying to set it causes ListView (Table in SWT) to use default theme instead. On the other hand, setting dark theme changes scrollbars to dark.

I'm rather worried about changing `Table#explorerTheme` to false, because I suspect that most users only tested it with true in the last 10-15 years, so any number of new problems can pop up.

I'm currently trying to find if it's possible to only change scrollbars but leave the other parts of Table intact. No success so far.
Comment 31 Reinhard Handler CLA 2020-07-07 05:27:59 EDT
*** Bug 564822 has been marked as a duplicate of this bug. ***
Comment 32 Rolf Theunissen CLA 2020-07-28 12:15:29 EDT
*** Bug 565605 has been marked as a duplicate of this bug. ***
Comment 33 Gayan Perera CLA 2020-07-29 11:24:10 EDT
(In reply to Alexandr Miloslavskiy from comment #30)
> Thanks for the steps. It does reproduce for me.
> 
> Studying it, I found that changing `Table#explorerTheme` to false in dark
> theme fixes the problem. And it actually needs to be false as per Comment
> 12, because Win10 doesn't currently have a dark theme entry for ListView, so
> trying to set it causes ListView (Table in SWT) to use default theme
> instead. On the other hand, setting dark theme changes scrollbars to dark.
> 
> I'm rather worried about changing `Table#explorerTheme` to false, because I
> suspect that most users only tested it with true in the last 10-15 years, so
> any number of new problems can pop up.
> 
> I'm currently trying to find if it's possible to only change scrollbars but
> leave the other parts of Table intact. No success so far.

What if we have this with a feature switch. So some group of people can tryout this option with the flag on and report bugs if we found any. Otherwise we can enable this by default in the next release. WDYT ?
Comment 34 Alexandr Miloslavskiy CLA 2020-07-29 11:31:14 EDT
I'm going to submit a patch that reworks dark scrollbars on Windows and removes this problem. Need some time to finish this patch.
Comment 35 Lars Vogel CLA 2020-07-29 13:17:04 EDT
(In reply to Alexandr Miloslavskiy from comment #34)
> I'm going to submit a patch that reworks dark scrollbars on Windows and
> removes this problem. Need some time to finish this patch.

Thanks a lot, Alexandr
Comment 36 Lars Vogel CLA 2020-08-12 11:09:35 EDT
(In reply to Lars Vogel from comment #35)
> (In reply to Alexandr Miloslavskiy from comment #34)
> > I'm going to submit a patch that reworks dark scrollbars on Windows and
> > removes this problem. Need some time to finish this patch.
> 
> Thanks a lot, Alexandr

Next week we will have M3. Would be great to have this in for the 4.17 release.
Comment 37 Alexandr Miloslavskiy CLA 2020-08-12 11:41:41 EDT
We also have an upcoming release and there are problems to solve in another 3rd party library :(  I think I carved some time for SWT, so I'll try to finish the patch before more issues come to demand my attention.
Comment 38 Eclipse Genie CLA 2020-08-12 16:03:33 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/167619
Comment 39 Alexandr Miloslavskiy CLA 2020-08-12 17:13:25 EDT
OK, here's the patch. Lars, would you do the testing?
Comment 40 Lars Vogel CLA 2020-08-13 08:54:21 EDT
Created attachment 283854 [details]
Screenshot with fix from Alexandr

Looks much better with the fix.
Comment 41 Lars Vogel CLA 2020-08-13 08:57:58 EDT
Created attachment 283855 [details]
Screenshot for code completion with fix
Comment 42 Gayan Perera CLA 2020-08-13 11:02:00 EDT
Comment on attachment 283855 [details]
Screenshot for code completion with fix

Can’t we change the color from css or make it any brighter?
Comment 44 Alexandr Miloslavskiy CLA 2020-08-18 13:08:59 EDT
Verified in I20200818-0900:
* Problem in Ctrl+3 is solved
* Dark Scrollbars still work as expected
* Various pages in Eclipse Settings look reasonable
Comment 45 Pierre-Yves Bigourdan CLA 2020-08-18 13:31:07 EDT
Checked the latest build as well, the dark theme is usable again on Windows. Thanks for working on this Alexandr!
Comment 46 Pierre-Yves Bigourdan CLA 2020-08-19 13:03:14 EDT
Created attachment 283910 [details]
Dark menus in Eclipse on Windows

I just noticed that the Windows menus were now styled in the dark theme?!? This was not the case in earlier 4.17M2. Is this an unexpected side-effect of this patch or does it come from somewhere else? Either way, it's really neat, and would deserve a N&N mention!
Comment 47 Alexandr Miloslavskiy CLA 2020-08-19 13:07:03 EDT
Yes, this is a side effect of this patch. I totally forgot about it because in our product we used a similar approach for a long time. The dark popup menus are enabled with 'SetPreferredAppMode', which is part of new approach in SWT since my last patch.
Comment 48 Alexandr Miloslavskiy CLA 2020-08-19 13:13:46 EDT
If anyone is willing to do a N&N entry, you're welcome to do so.
Comment 49 Lars Vogel CLA 2020-08-19 13:37:23 EDT
(In reply to Alexandr Miloslavskiy from comment #47)
> Yes, this is a side effect of this patch. I totally forgot about it because
> in our product we used a similar approach for a long time. The dark popup
> menus are enabled with 'SetPreferredAppMode', which is part of new approach
> in SWT since my last patch.

Awesome! Thanks a bunch Alexandr! 4.17 will be a great dark theme windows release thanks to your work.
Comment 50 Eclipse Genie CLA 2020-08-20 03:44:58 EDT
New Gerrit change created: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/167992
Comment 51 Lars Vogel CLA 2020-08-20 03:48:35 EDT
(In reply to Alexandr Miloslavskiy from comment #48)
> If anyone is willing to do a N&N entry, you're welcome to do so.

For menu: https://git.eclipse.org/r/c/www.eclipse.org/eclipse/news/+/167993
Comment 53 Rolf Theunissen CLA 2020-08-22 05:24:27 EDT
(In reply to Gayan Perera from comment #42)
> Comment on attachment 283855 [details]
> Screenshot for code completion with fix
> 
> Can’t we change the color from css or make it any brighter?

Great work has been done here. However, the selection color of not active trees doesn't have any contrast w.r.t. the the dark background. As a result, the dark theme is still useless to be used in daily practice.

Can this selection color be changed? Please comment in Bug 564960.
Comment 54 Rolf Theunissen CLA 2020-08-22 06:31:17 EDT
(In reply to Rolf Theunissen from comment #53)
> (In reply to Gayan Perera from comment #42)
> > Comment on attachment 283855 [details]
> > Screenshot for code completion with fix
> > 
> > Can’t we change the color from css or make it any brighter?
> 
> Great work has been done here. However, the selection color of not active
> trees doesn't have any contrast w.r.t. the the dark background. As a result,
> the dark theme is still useless to be used in daily practice.
> 
> Can this selection color be changed? Please comment in Bug 564960.

The problem is not in the selection color, but in the custom background color in the dark theme that is too close to the selection color.