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
8271923: [macos] the text color on the selected disabled tabbed pane button remains white making text unreadable #5217
Conversation
|
/issue remove 2d,awt |
@prsadhuk This PR does not contain any additional solved issues that can be removed. To remove the primary solved issue, simply edit the title of this PR. |
/label remove 2d, awt |
@prsadhuk The |
Webrevs
|
@@ -77,7 +80,7 @@ protected void paintTitle(final Graphics2D g2d, final Font font, final FontMetri | |||
protected static Color getSelectedTabTitleColor(boolean enabled, boolean pressed) { | |||
if (enabled && pressed) { | |||
return UIManager.getColor("TabbedPane.selectedTabTitlePressedColor"); | |||
} else if (!enabled) { | |||
} else if (!enabled || (!JRSUIUtils.isMacOSXBigSurOrAbove() && !isFrameActive)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we enter this condition in BigSur when SwingSet2 is not focused?
If yes, Will we not see difference in color between "new ColorUIResource(new Color(1, 1, 1, 0.55f))" and updated "black" color ?
If no, In BigSur from where black color is picked for selectedTabTitleDisabledColor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In BigSur, there is no difference between if frame is focused or non-focused. It is always black on white (BigSur tabbedpane text design is different than Catalina).......it's not selectedTabTitleDisabledColor which governs this but selectedTabTitleNormalColor...There the text is governed by selectedControlTextColor via this code...
"TabbedPane.selectedTabTitleNormalColor", JRSUIUtils.isMacOSXBigSurOrAbove() ? selectedControlTextColor : selectedTabTitleNormalColor,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does inactive frame lead to "enabled" having "false" value? What is the difference between "enabled" flag and "frameActive" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inactive frame is non-focused frame...
enabled false is tabbedpane is not enabled...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me elaborate my question, it is still not clear to me.
If i click on tabbedpane(enabled -> true), then move focus out of this Frame(SwingSet2) will that make enabled-> false? Is there any hierarchical relation between enabled & frameActive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it will not. To make enabled false, you need to call tabPane.setEnabled(false);
frameActive is to decide if frame is focused or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification
Code change looks good to me. Any reason why we dont have regression test for this change? I think we can add simple TabbedPane scenario for non BigSur use case and read pixel data. Also there is no "noreg-*" label in JBS. |
We need to put focus on another window and also it canbe viewed by SwingSet2 and any other mac native window toggling the focus between the two which is why no reg test is added..I can add noreg label to it.. |
Does reading pixel data using Robot bring back focus on the frame? I am not sure about it. If that is the case then i can see why we might have issues adding regression test. Otherwise we can add regression test for this patch. |
No, the issue is we need to have 2 window...I am not sure how to add 2 window and bring focus to the other non-Java window automatically. So, I have relied on SwingSet2 to see the issue. You can have SwingSet2 and Preferences->Keyboard system dialog and toggle between the 2...It is already mentioned in JBS. BTW, I am now using nonFocus color and not changing anything in if (!enabled) |
I dont think we need non-Java or 2 windows to reproduce the issue. We can just create 1 Java Frame with TabbedPane -> click on the tabbed pane -> and click Robot outside the scope of the Java Frame to see this issue. After that we can read the pixel data of the text in TabbedPane to check whether we have issue or not(As already mentioned if focus comes back when we try to read pixel data, then i can see issue with writing regression test). Please clarify if i am missing something. And its good that we are not touching if (!enabled) use case. |
It will be difficult to prove the issue for text color as robot will pick the pixels for tabbedpane along with background, not only text. Also, it's not for all macos, it's only for Catalina...we don't have requires tag to omit specific macos.. |
@prsadhuk This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 176 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
|
/integrate |
Going to push as commit df05b4d.
Your commit was automatically rebased without conflicts. |
I just completed a review of the previous fix(JDK-8269984) for jdk11, and found that the text is still unreadable if the selected tab is pressed by the user, look like it is still reproduced after this fix as well, please take a look. |
It's not clear where you tried 8269984 and this fix, is it on BigSur or Catalina? FYI, this fix is to cater to Catalina problem and will not have any effect on BigSur. |
I tested macos 11.5 |
I raised https://git.openjdk.java.net/jdk/pull/5409 for the "pressed" issue on BigSur. |
Thank you! |
It is seen that if a JTabbedPane is unfocused, it's title is painted with white text on grey background
as opposed to black text on grey background in unfoucsed native app on macOSX Catalina
and is somewhat not legible.
This can be seen with SwingSet2 demo with InternalFrame or JTabbedPane demo and any native app, making focus toggle between the two.
Issue was TabbedPane always draw with "selectedTabTitleNormalColor" which is white. Although Aqua L&F defined selectedTabTitleDisabledColor but it is not used as TabbedPane does not check if focus is there in current frame and draw accordingly, which native app does.
Proposed fix is to check for frame is active or not and draw text color accordingly.
Since it is not affecting BigSur (where even if native app active or not text is always drawn in same color), it is only restricted to Catalina and lower.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5217/head:pull/5217
$ git checkout pull/5217
Update a local copy of the PR:
$ git checkout pull/5217
$ git pull https://git.openjdk.java.net/jdk pull/5217/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 5217
View PR using the GUI difftool:
$ git pr show -t 5217
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5217.diff