nvaccess / nvda

NVDA, the free and open source Screen Reader for Microsoft Windows
Other
2.08k stars 625 forks source link

alt+up / alt+down is not working in Visual Studio Code #17082

Open Danstiv opened 2 weeks ago

Danstiv commented 2 weeks ago

Steps to reproduce:

  1. Launch the vscode with default settings.
  2. Open / create some multiline file.
  3. Try to move lines with alt+up and alt+down hotkeys.

    Actual behavior:

    Lines is not moving.

    Expected behavior:

    Keyboard shortcuts work as usual, the line under the cursor moves up/down.

NVDA logs, crash dumps and other attachments:

System configuration

NVDA installed/portable/running from source:

Installed

NVDA version:

alpha-33623,37b40464 (2025.1.0.33623)

Windows version:

Windows 11 23H2 (AMD64) build 22631.4037

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

Visual Studio Code

Version: 1.92.1
Commit: eaa41d57266683296de7d118f574d0c2652e1fc4
Date: 2024-08-07T20:16:39.455Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

Other information about your system:

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.

NVDA from source before that commit works normally. 68f5fcc15 Fix PowerPoint caret reporting when text contains wide characters, and overall improvement of TextInfo implementation (#17015)

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?

Yes.

seanbudd commented 2 weeks ago

cc @LeonarddeR

michaelDCurran commented 2 weeks ago

Technical: It looks like IA2TextTextInfo always supported _getSentenceOffsets, as IAccessible2 does have a sentence unit. However, OffsetsTextInfo _getUnitOffsets did not support sentence, therefore it was never used. Now that OffsetsTextInfo knows about sentence, at least allowing subclasses to implement _getSentenceOffsets, this means that IAccessible2's sentence support is suddenly exercised and therefore moving by sentence in the base EditableText class does not raise an error, thus alt+upArrow and alt+downArrow actually work for IAccessible2 and therefore in VS Code. The easiest way to revert this behaviour is to remove IA2TextTextInfo's _getSentenceOffsets method. But I think this requires a little more consideration. I think the binding of alt+upArrow / alt+downArrow across the board is debatable...

LeonarddeR commented 2 weeks ago

I think there are several approaches that can be combined:

  1. Allow an EditableText override to explicitly opt in/out to sentence nav. Word, PowerPoint, etc. should opt-in, VS Code should opt-out
  2. If the sentence nav state is undermined, let _caretMoveBySentenceHelper execute the gesture first and only try to sentence nav when executing the gesture didn't yield a caret event

This ensures that in Chrome, sentence nav will work in certain edit controls with the cost of a little delay, whereas in VS Code on the web, sentence nav will not apply.

cary-rowen commented 1 week ago

cc @mltony

CC Tony for reference, this may also need attention when implementing the sentence navigation feature later.