Skip to content

When requesting formatting information, default colors are now explicitely reported in Wordpad and other edit fields#13942

Merged
seanbudd merged 12 commits into
nvaccess:masterfrom
CyrilleB79:reportDefaultColor
Oct 10, 2022
Merged

When requesting formatting information, default colors are now explicitely reported in Wordpad and other edit fields#13942
seanbudd merged 12 commits into
nvaccess:masterfrom
CyrilleB79:reportDefaultColor

Conversation

@CyrilleB79

@CyrilleB79 CyrilleB79 commented Jul 24, 2022

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #13959

Summary of the issue:

In Wordpad or in log viewer, pressing NVDA+F reports "default color on default color" as color information in formatting information. This information is of no use to know the color really displayed, what may be necessary when working with sighted persons.

  • In log viewer and other system edit fields, default colors are the ones provided by the system and can vary according to system settings, e.g. enabling high contrast theme.
  • In Wordpad, "Default color" is meant to be the one called "Automatic" and corresponds to system color.

Description of user facing changes

  • When pressing NVDA+F in Wordpad or NVDA log viewer, NVDA reports the text / background color and in addition, indicates if it is the default color, i.e. system color.
    • I have not bothered to report the application's color "Automatic" in Wordpad instead of "default" because it would probably need to create a WordPad appModule and specific processing just for this distinction; I think it was not worth it.
  • In MS Word, when the text color is set to "Automatic", "Automatic color" is reported instead of "default color". Indeed, this matches Word application terminology; in Word, automatic color and default color are two distinc concepts:
    • "automatic" is a color which adapts to favorise a sufficient contrast with the background
    • "default color" is the color of the text when you open a new document (if registered in normal.dot) or when you remove formatting (when registered in the current document only).

Description of development approach

According to the CHARFORMATW structure for the class EditTextInfo and to ITextFont::GetForeColor for the class ITextDocumentTextInfo, the system colors are used for default colors. Thus, I retrieve these colors in these cases.

Testing strategy:

Manual tests:

For the class ITextDocumentTextInfo:

  • Tested NVDA+F in WordPad (default automatic color) and log viewer
  • Activated high contrast and changed the thems to check that the colors changed as visually.

For the class EditTextInfo, I have performed the same tests, making previously the changes in #11897 (comment).

Known issues with pull request:

  • In Word, I have not found a way to know the real color of the text when automatic is selected; thus only this information is provided.
  • When UIA is enabled in Word, the true colors are reported, but we do not have the information if it corresponds to "automatic" selected in the application or if a "true" color is selected.

Change log entries:

Bug fixes
When requesting formatting information, colors are now explicitly reported in Wordpad or log viewer, rather than only "Default color". (#13959)

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 85d724fa09

@CyrilleB79 CyrilleB79 marked this pull request as ready for review July 25, 2022 05:08
@CyrilleB79 CyrilleB79 requested a review from a team as a code owner July 25, 2022 05:08
@CyrilleB79 CyrilleB79 requested a review from seanbudd July 25, 2022 05:08
@seanbudd seanbudd added this to the 2022.4 milestone Jul 25, 2022
@CyrilleB79 CyrilleB79 marked this pull request as draft July 25, 2022 20:49
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

I realize that the issue is broader since "Default color" is also reported in MS Word when the color is "Automatic".

Converting to draft while investigating further.

@lukaszgo1 lukaszgo1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there at least two other places (support for pre UIA dropdowns in Excel, and retrieval of highlight colors in display model) where GetSysColor is used it makes sens to create a wrapper around it in winUser, and an IntEnum which defines values representing known display elements this function accepts.

@CyrilleB79

Copy link
Copy Markdown
Contributor Author

I have opened #13959 to discuss how default colors need to be reported more generally.

@seanbudd seanbudd removed this from the 2022.4 milestone Aug 31, 2022
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

I have updated the code and the initial description taking into account what was discussed in #13959 (Cc @feerrenrut).

I still have to create a wrapper for GetSysColor as suggested by @lukaszgo1, I guess in the new winAPI/winUser/__init__.py file. Then this PR will be ready for review again.

@CyrilleB79

CyrilleB79 commented Sep 26, 2022

Copy link
Copy Markdown
Contributor Author

This PR is now ready to review again.

Note for those who have reviewed it at the beginning: Please re-read the initial description that have been modified.

Also, I have made a wrapper for GetSysColor as per #13942 (review).

  • In the SysColorIndex enum, I have only added the items for the values we use; let me know if the recommended way to do is to already integrate all the possible items instead, even those which we do not use yet.
  • Regarding tests, I have only tested the log viewer. How can I test other uses of GetSysColor (Excel, displayModel?)

@CyrilleB79 CyrilleB79 marked this pull request as ready for review September 26, 2022 14:17
@CyrilleB79 CyrilleB79 requested review from lukaszgo1 and removed request for seanbudd September 26, 2022 14:18
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit becfe662f3

@lukaszgo1

Copy link
Copy Markdown
Contributor
* Regarding tests, I have only tested the log viewer. How can I test other uses of GetSysColor (Excel, displayModel?)
  • When testing default selection colors in DisplayModel I personally use Fast Log Entry - there is nothing special about it other than its main edit control has to be accessed via Display Hooks, and it uses default system colors for selection. I've tested the build from this PR, and can confirm that selections can still be reported in display model.
  • The Drop downs in Excel rely on display hooks in 2010 and earlier (possibly also in 2013 but don't quote me on that). Since it is likely you don't have easy access to legacy versions of Office I've also tested that with this PR drop downs in Excel 2010 behave as expected.

@CyrilleB79

Copy link
Copy Markdown
Contributor Author

Many thanks @lukaszgo1 for these tests.

@CyrilleB79 CyrilleB79 closed this Sep 26, 2022
@CyrilleB79 CyrilleB79 reopened this Sep 26, 2022
@seanbudd seanbudd self-requested a review September 26, 2022 23:54

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good to me, thanks @CyrilleB79

Comment thread source/NVDAObjects/window/winword.py
Comment thread source/NVDAObjects/window/edit.py Outdated
Comment thread source/winAPI/winUser/__init__.py Outdated
@seanbudd seanbudd marked this pull request as draft September 29, 2022 05:42
@CyrilleB79 CyrilleB79 marked this pull request as ready for review October 6, 2022 09:03

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @CyrilleB79 , looks almost ready

Comment thread source/NVDAObjects/window/edit.py Outdated
Comment thread source/NVDAObjects/window/edit.py Outdated
@CyrilleB79 CyrilleB79 requested a review from seanbudd October 7, 2022 07:37

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @CyrilleB79

@seanbudd seanbudd merged commit de86749 into nvaccess:master Oct 10, 2022
@nvaccessAuto nvaccessAuto added this to the 2023.1 milestone Oct 10, 2022
@CyrilleB79 CyrilleB79 deleted the reportDefaultColor branch October 10, 2022 19:57
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

Successfully merging this pull request may close these issues.

A color reported as "default" gives no information

5 participants