nvaccess / nvda

NVDA, the free and open source Screen Reader for Microsoft Windows
https://www.nvaccess.org/
Other
2.11k stars 637 forks source link

Formatting in Word: style is not properly reported in some cases with UIA enabled #11427

Open AAClause opened 4 years ago

AAClause commented 4 years ago

Steps to reproduce:

Several ways to reproduce this, here's one:

  1. Open Microsoft Word, create a new document.
  2. Write an URL (e.g. https://google.com) then press enter.
  3. Move the cursor on the last character of the previous line (i.e. m).
  4. Press NVDA+f.

Actual behavior:

Something like "style <POINTER(IUnknown) ptr=0x5d9bbd24 at 52462b0>" is reported.

Expected behavior:

The correct style should be reported (in this case 'Normal').

System configuration

NVDA installed/portable/running from source:

Installed

NVDA version:

alpha-20601,3a9484fb

Windows version:

10 Insider (64-bit) build 20175.1000

Name and version of other software in use when reproducing the issue:

Microsoft Office Word 16.0.13001.20384

Other information about your system:

UIA enabled

Other questions

Does the issue still occur after restarting your computer?

Yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

Not tested

If addons are disabled, is your problem still occuring?

Yes

Did you try to run the COM registry fixing tool in NVDA menu / tools?

Yes

Adriani90 commented 4 years ago

@Andre9642 this issue does not occur if UIA Support in Word is disabled. Is this correct?

AAClause commented 4 years ago

@Adriani90 Yes, absolutely.

ainekc commented 3 years ago

Also NVDA doesn't read any line or para info for me when UIA is enabled. Works as expected without UIA.

michaelDCurran commented 3 years ago

Technical: When an IUIAutomationTextRange spans the last character of a link, GetAttributeValue given UIA_StyleNameAttributeId returns a ReservedMixedAttributeValue object rather than the name of the style E.g. 'Normal'. This is true even if the style of the link is identical to the style after the link. This seems to be a bug in Microsoft Word. At most we could not include style if its value is MixedAttributeValue, or we can report "Unknown" or "Mixed". But that is as far as we can go in NVDA. @aaclause which do you think would be the best approach until this is addressed in MS word?

AAClause commented 3 years ago

@michaelDCurran In this case, I would prefer not to include the style since it is unknown. "mixed" seems vague to me.

Out of curiosity I tested with JAWS (version 2021.2107.12, UIA in Word enabled), here are the results:

My original line (link): https://google.com/

From position 1 to -1 ("ttps://google.com/"), we get:

Insertion point formatting Single underline 11 point DodgerBlue3 on Blanc Calibri Lien hypertexte style

Line spacing: 1 lines.

Paragraph formatting: Aligned left

Outline level: body text

At position 0 ('h'):

Insertion point formatting 11 point DodgerBlue3 on Blanc Calibri Normal style

Line spacing: 1 lines.

Paragraph formatting: Aligned left

Outline level: body text

For the reference, with NVDA we get:

From position 0 to -2 ("https://google.com"):

style Normal Calibri 11 pt aqua-blue on white underlined baseline align left line spacing 1,08 multiple

At position -1 ('/'):

style <POINTER(IUnknown) ptr=0x6e0e7cdc at bab22b0> Calibri 11 pt white background underlined baseline align left line spacing 1,08 multiple

CyrilleB79 commented 3 years ago

Note that also the foreground color is not available for this last character of the link. But on the contrary to style, the information is just omitted.

XLTechie commented 2 years ago

@michaelDCurran versions of this can still be replicated in Word (365 and 2019, at least), as recently asked about on an NVDA users list.

I can replicate it with UIA on, entering/pasting a link, and navigating back up to the line with the link on it. style <POINTER(IUnknown) ptr=0x6e7c6cb4 at 51e2710>

UIA off reports this as style hyperlink.

If the only options are what you describe above, then my vote is for style mixed.

Unknown is untrue, since in non-UIA mode it is knowable.

LittleStar-VIP commented 2 years ago

I have reported the problem to Microsoft accessibility help desk, and have also attached the link of this thread to the supporting staff.

feerrenrut commented 2 years ago

Happy for a PR to improve the UX of the failure, reporting "unknown" rather than the object string would be better. This would only be until the issue can be fixed in MS word.

AAClause commented 2 years ago

@feerrenrut In that case, how about omitting the style information? For instance, when alignment info is not available nothing is reported