Skip to content
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

In ui.browseableMessage, every other line is empty #16995

Closed
CyrilleB79 opened this issue Aug 12, 2024 · 6 comments · Fixed by #16998
Closed

In ui.browseableMessage, every other line is empty #16995

CyrilleB79 opened this issue Aug 12, 2024 · 6 comments · Fixed by #16998
Labels
bug/regression p3 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority release/blocking this issue blocks the milestone release triaged Has been triaged, issue is waiting for implementation.
Milestone

Comments

@CyrilleB79
Copy link
Collaborator

Steps to reproduce:

  • Press NVDA+V to ensure screen layout is off.
  • On a webpage, press 2 times NVDA+F
  • Press many times down arrow
  • Press NVDA+V to enable screen layout
  • Press up/downArrows again to explore the lines

Actual behavior:

Every other line is empty when screen layout is off.

Expected behavior:

The content should not contain empty lines between useful lines; screen layout should not have any impact here.

NVDA logs, crash dumps and other attachments:

N/A

System configuration

NVDA installed/portable/running from source:

Installed

NVDA version:

Version : source-master-c8a847b (2024.4.0.0)

Windows version:

Windows 10

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

N/A

Other information about your system:

N/A

Other questions

Does the issue still occur after restarting your computer?

Not tested, probably yes

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

2024.3rc1 is OK, i.e. no such issue.

If NVDA add-ons are disabled, is your problem still occurring?

Yes

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

Not tested, probably unrelated.

Notes

This issue is very likely introduced by #16369. Cc @XLTechie.
Thus #12004 has been reintroduced unfortunately.

@XLTechie
Copy link
Collaborator

XLTechie commented Aug 12, 2024 via email

@XLTechie
Copy link
Collaborator

XLTechie commented Aug 12, 2024 via email

@seanbudd seanbudd added this to the 2024.4 milestone Aug 12, 2024
@XLTechie
Copy link
Collaborator

I think part of the problem might be in the C code, specifically in NVDAHelper.localLib.VBuf_getLineOffsets.
I might be able to figure out what's going on there (my C is very rusty, but I may remember enough), but at the moment I can't find where the code for that function is. Can anyone with more recent C experience point me to this?
I see that it is exported in nvdaHelper/local/nvdaHelperLocal.def, but that's as much as I have learned.

Probably not an approved use, but maybe I can ask @coderabbitai where the source code for NVDAHelper.localLib.VBuf_getLineOffsets can be found?

Copy link
Contributor

coderabbitai bot commented Aug 13, 2024

Tip

For best results, initiate chat on the files or code changes.

@XLTechie, I've searched through the nvdaHelper directory, but the implementation of VBuf_getLineOffsets wasn't found in the C/C++ source files. It's possible that this function is part of a library linked during the build process or defined in a way not captured by the search (e.g., as a macro or inline function).

You might want to check the build scripts or linked libraries for additional clues. If you have access to the build configuration or any related documentation, that might provide further insights. Let me know if there's anything else I can assist you with!

Analysis chain


Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the definition of the VBuf_getLineOffsets function in the C/C++ source files.
ast-grep --lang c --pattern 'VBuf_getLineOffsets($_)' 

Length of output: 55


Script:

#!/bin/bash
# Use ripgrep to search for the VBuf_getLineOffsets function in the repository.
rg 'VBuf_getLineOffsets' -A 5

Length of output: 1476


Script:

#!/bin/bash
# Search for the VBuf_getLineOffsets function in the C/C++ files within the nvdaHelper directory.
rg 'VBuf_getLineOffsets' nvdaHelper -t c -t cpp -A 5

Length of output: 52


Script:

#!/bin/bash
# Search for the VBuf_getLineOffsets function in all files within the nvdaHelper directory.
rg 'VBuf_getLineOffsets' nvdaHelper -A 5

Length of output: 413

@michaelDCurran
Copy link
Member

It looks like MSHTML converts line feeds into <br> tags within a <pre> tag. I didn't think this is what a browser was supposed to do. pre tags should have plain text, and no other elements.
Assuming we're not doing anything wrong here in the way we are inserting the message, we might need to change mshtml VBufBackend's fillVBuf to replace br tags with \n assuming we are not already doing that. Right now I'm guessing we are rendering a br tag as a block-level element with a \n inside.
File: nvdaHelper/vbufBackends/mshtml/mshtml.cpp

@XLTechie
Copy link
Collaborator

@michaelDCurran regarding your comment above, this only happens to <pre> newlines, while in screen layout off mode. That suggests to me, that it's not the browser's fault.

I tried various changes in the MSHTML VBuf code per your suggestion, but could not figure out where this is handled differently for screen layout off, vs. screen layout on. Regardless, nothing I tried was successful.

seanbudd pushed a commit that referenced this issue Aug 29, 2024
…after the message, and add buttons to some instances (2nd try) (#17018)

Fixes #14641
Addresses #16995
Addresses #16996

Summary of the issue:
In #14641 @Qchristensen reported that some users are confused by browseableMessages, and their lack of definite closure mechanisms.
During the conversation, it was pointed out that in some cases, a user might also desire a copy button.
During work on the PR (originally #16369), it was requested that the copy button be given an accelerator key.

Description of user facing changes
Added copy and close buttons to some browseableMessages, and the capability to add them to others.

Description of development approach
Thanks to @michaelDCurran's change in ui.browseableMessage--namely adding a Scripting.Dictionary to carry arbitrary query-string-equivalent style parameters to the mshtml instance behind browseableMessage, it is now possible to pass in values for two new buttons, and various translatable messages, without any contortions.
Tried different methods in the JS and CSS of message.html, and eventually settled on one which displayed the two buttons side-by-side, under a separator. If neither button's label is supplied, the div containing the HR and buttons remains hidden.
The "Copy" button can be activated with Ctrl+Shift+C, and the "Close" button by Escape. Alt+C is indicated to the user via an accessibility label.
Fixed up some docstring parameter listings to match modern format.
Per the issue, modified the Report Link Destination message, to have both a copy button and a close button.
Per the issue, added buttons to the Report Character Information message.
Per request in PR comments, used a live region to present a "Copy complete" or "copy failed" message to the user. This message remains on screen for five seconds.
The AI suggested covering for more failures in the initialization and configuration of MSHTML. I used its suggested exception checking, but added a private function to display an error message to the user when one of the components fail, so at least some kind of user notice can be given. I based it on the already extant private function for messaging the user if a browseableMessage is called on a secure screen.
Both of the warning functions for browseableMessage unavailable situations, are now self-contained, with respect to wx.
Added an immediate return if the MSHTML window is opened without providing the dialog arguments (i.e. the message and title, at least). That situation should never actually occur, but in the unlikely event that a failure passes the error checking we have in browseableMessage, this will return immediately, instead of stranding the user in a blank window with no obvious close mechanism.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/regression p3 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority release/blocking this issue blocks the milestone release triaged Has been triaged, issue is waiting for implementation.
Projects
None yet
4 participants