Fix regression when reading and deleting text in MS Excel edit fields.#9063
Conversation
…gain in Microsoft Excel edit fields. Fix for nvaccess#9042
LeonarddeR
left a comment
There was a problem hiding this comment.
I think we should do either one of the following.
- Create a list of badUdentifiedEditClassNames and list this window class in there.
- If this window class is specific to Excel, which I think it is, this should be handled in an Excel appModule
- Similar to the windowText and windowTextLineCount properties, create a windowTextLength property that fetches the window text length:
return watchdog.cancellableSendMessage(nav.windowHandle,winUser.WM_GETTEXTLENGTH,0,0)
Then, only set UnidentifiedEdit as an overlay if there is text in the control. For Excel, this returns 0 even though there is text. A drawback of this approach is that unidentified text edits will always initialize with a display model overlay class when they are found to be empty.
This is clearly a bad implementation in Excel, as the text is perfectly provided using the window text.
@michaelDCurran: Do you have thoughts about this? I prefer either 2 or 3.
…orking again in Microsoft Excel edit fields. Fix for nvaccess#9042" This reverts commit c360ddf.
|
For me option two looked most reasonable, so I've committed required changes. Of course if @michaelDCurran would have a different opinion I am ready to reorganize it. |
LeonarddeR
left a comment
There was a problem hiding this comment.
I think this is the way to go indeed.
|
|
||
| def chooseNVDAObjectOverlayClasses(self, obj, clsList): | ||
| windowClass = obj.windowClassName | ||
| # #9042 Edit fields in Excel have to be accessed via displayModel. |
There was a problem hiding this comment.
There usually is a colon after the issue number in such comments.
| # #9042 Edit fields in Excel have to be accessed via displayModel. | |
| # #9042: Edit fields in Excel have to be accessed via displayModel. |
| windowClass = obj.windowClassName | ||
| # #9042 Edit fields in Excel have to be accessed via displayModel. | ||
| if windowClass == "EDTBX": | ||
| clsList.insert(0, DisplayModelEditableText) |
There was a problem hiding this comment.
You will also have to import UnidentifiedEdit from NVDAObjects.window.edit and remove that from the clsList. Make sure to wrap this in a try/except statement. See the putty module as an example.
|
@LeonarddeR All your commends are now addressed. |
Link to issue number:
Fixes #9042
Summary of the issue:
When #8165 was introduced it was assumed, that if particular edit field exposes line information it do not have to be accessed via displayModel. It unfortunately broke accessibility of most edit fields in Excel.
Description of how this pull request fixes the issue:
For the class used by these fields displayModel is used again.
Testing performed:
Tested with go to, find and custom list editing in Microsoft Excel 2010 and 2019.
Known issues with pull request:
I am pretty new to this part of the code, so it is possible, that it should be solved in a completely different way. @LeonarddeR your opinion would be appreciated.
Change log entry:
Section: Bug fixes
NVDA will again track cursor and announce deleted characters in edit fields in Microsoft Excel such as go to or find.