nvda icon indicating copy to clipboard operation
nvda copied to clipboard

UI Automation in Windows Console and Windows Terminal: Make POSITION_FIRST and POSITION_LAST relative to visible text in FORMATTED consoles

Open codeofdusk opened this issue 2 years ago • 7 comments

Link to issue number:

Closes #13157.

Summary of the issue:

The ability for users to explore all console text enabled by #12669 has been well appreciated, but it poses problems in paginated output (less, more, etc.) as the review cursor jump to top/bottom commands are relative to the entire buffer, which can grow quite large.

Description of how this pull request fixes the issue:

Re-introduces a (generalized) ConsoleUIATextInfo to formatted consoles and wt that limits POSITION_FIRST and POSITION_LAST to the first and last visible (not absolute) text range. This textInfo implementation overrides no other behaviour in FORMATTED consoles.

Testing strategy:

Tested that the review cursor works as expected in FORMATTED and IMPROVED consoles and Windows Terminal.

Known issues with pull request:

  • It is now impossible to jump quickly to the top/bottom of the entire buffer.
  • There might be a better way to do this. Initially opening this PR as draft to get feedback on the approach.
  • The jump to top/bottom commands in these terminals now behave differently to the rest of NVDA (you can "jump to top line", then scroll up beyond it). It seems this behaviour is wanted (from discussions in that issue and by email with users) but something of which to be aware.

Code Review Checklist:

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

codeofdusk avatar May 08 '22 20:05 codeofdusk

Could @michaelDCurran please provide feedback on this approach?

codeofdusk avatar May 08 '22 20:05 codeofdusk

How does movement by the page unit behave in consoles? Wouldn't it be better and more consistent to add review commands to move the review cursor by page?

LeonarddeR avatar May 13 '22 13:05 LeonarddeR

How does movement by the page unit behave in consoles?

It isn't defined.

Also CC @carlos-zamora.

codeofdusk avatar May 26 '22 06:05 codeofdusk

How does movement by the page unit behave in consoles?

It isn't defined.

Also CC @carlos-zamora.

Hmm. We (Console) probably should define it though. Scrolling by "page" is currently just scrolling by viewport height (at least in Windows Terminal).

carlos-zamora avatar May 26 '22 17:05 carlos-zamora

Tested that the review cursor works as expected in FORMATTED and IMPROVED consoles and Windows Terminal.

Can you elaborate on this with examples? It would be great to add system tests even, if possible.

It is now impossible to jump quickly to the top/bottom of the entire buffer.

I think this is a blocker - would it be possible to cache the top and the bottom somehow?

seanbudd avatar Jun 15 '22 06:06 seanbudd

Can you elaborate on this with examples?

  1. Start console.
  2. Run git log from a repo.
  3. Press the space bar.
  4. press Shift+numpad 7. NVDA jumps to the top of the currently displayed page.
  5. Press numpad 7 several times. The review cursor should scroll up, past the current page into earlier output in the buffer.

would it be possible to cache the top and the bottom somehow?

How might this help?

codeofdusk avatar Jun 22 '22 10:06 codeofdusk

@seanbudd, @michaelDCurran, @jcsteh any more thoughts on the approach here? This is becoming more relevant with #10964 and Windows Terminal eventually becoming the default console host.

codeofdusk avatar Aug 02 '22 04:08 codeofdusk

Just checking in again on this PR as I'll be out of time to work on it soon. CC @seanbudd.

codeofdusk avatar Aug 15 '22 02:08 codeofdusk

@codeofdusk - if you want a PR review with the approach as-is, please mark it as ready for review.

If you would like a detailed investigation and general advice on solving #13157, we will need to schedule the work for later - there is no priority for this to jump the queue compared to other PRs.

seanbudd avatar Aug 15 '22 02:08 seanbudd

  • This PR is a possible solution for #13157 but I'm concerned about unintended consequences of overriding POSITION_FIRST/POSITION_LAST in this way. Does anything else (besides review top/bottom line) depend on those positions, and will changing those to visible positions only in consoles break other assumptions in NVDA or plugins?
  • I do think that a more general solution should be considered (for instance, movement of review by page and implementation of UNIT_PAGE upstream, or additional scripts for moving to the top/bottom visible line). This would make review consistent across all NVDA controls (i.e. "move to top line" would continue to move to the actual top line of the console buffer, similar to other NVDA controls).
  • That said, this PR preserves muscle memory for longer time terminal users (i.e. "move to top" always moved to the top visible, not actual, line before #12669).

So I'm not quite sure what to do with this PR. Maybe @leonardder or @michaelDCurran could give input?

codeofdusk avatar Aug 16 '22 10:08 codeofdusk

The risks you describe with this PR seems like something a detailed investigation requires, or extensive testing on alpha.

I think #14021 is a safer approach. If it ends up not being comprehensive in fixing this issue, e.g. the muscle memory problem is too user hostile, we can look at the approach in this PR.

seanbudd avatar Aug 16 '22 23:08 seanbudd

I'm actually on the phone with @carlos-zamora right now! He agrees that #14021 makes more sense and is willing to implement the needed changes on the terminal side. Closing this PR in favour of that one.

codeofdusk avatar Aug 16 '22 23:08 codeofdusk