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

Constrain a11y word nav to the virtual bottom #5405

Closed
wants to merge 4 commits into from

Conversation

carlos-zamora
Copy link
Member

@carlos-zamora carlos-zamora commented Apr 18, 2020

Use the virtual bottom in ConHost to speed up a11y word navigation performance. GetTextBufferEndPosition() is also used by by search; it'll also get a minor performance boost.

PR Checklist

Detailed Description of the Pull Request / Additional comments

#7789 uses GetLastNonspaceCharacter() to determine where the last word is and exit early on a UIA::Move by word call. The change in this PR passes the virtual bottom over to GetLastNonspaceCharacter() to make that search a bit faster.

Tested word navigation on Host.exe using NVDA.

WPR Traces

The percentages below represent the weight that a function call had. The
test scenario included moving by word on the CMD welcome message until
the last word was reached. Inspect.exe was used to limit any additional
calls that are generally performed by a screen reader.

function current branch
UIA:Move 29.52% 28.43%

There is an improvement of about 1% in a release build of ConHost.

@carlos-zamora carlos-zamora added Area-Accessibility Issues related to accessibility Product-Conhost For issues in the Console codebase labels Apr 18, 2020
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will break anything. Virtual bottom should always be below the last written text so this should always work

src/host/renderData.cpp Outdated Show resolved Hide resolved
@codeofdusk
Copy link
Contributor

Thanks @carlos-zamora!

@carlos-zamora carlos-zamora marked this pull request as ready for review April 20, 2020 17:11
@carlos-zamora carlos-zamora force-pushed the dev/cazamor/acc/ch/word-nav-perf branch from 634034a to 78ebaca Compare April 20, 2020 17:42
Viewport bufferSize = gci.GetActiveOutputBuffer().GetBufferSize();
COORD endPosition{ bufferSize.Width() - 1, bufferSize.BottomInclusive() };
const auto mutableViewport = gci.GetActiveOutputBuffer().GetVirtualViewport();
COORD endPosition{ mutableViewport.Width() - 1, mutableViewport.BottomInclusive() };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just so i understand: this is not impacted by the user having scrolled up? the viewport usually is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the good news is that the returned value is not impacted by the user having scrolled up. The bad news is, your comment led me down a rabbit hole of realizing that #6453 exists. This was already in master though.

@codeofdusk
Copy link
Contributor

Any updates on this PR? Thanks.

@miniksa
Copy link
Member

miniksa commented Apr 27, 2020

I came by to look at this but three things stick out:

  1. Outstanding comments by @DHowett-MSFT that don't look answered yet.
  2. The x64 build is failing.
  3. @carlos-zamora hasn't attached the WPR traces before/after he said he was going to.

So I'm going to skip reviewing it for now and come back later hoping some of those progress.

@codeofdusk
Copy link
Contributor

Do you intend to merge this in time for 21H1? It would mean a lot for NVDA. Thanks!

@carlos-zamora
Copy link
Member Author

@codeofdusk Yeah! I've had bad luck the last few days where suddenly my internet goes down or my machine refuses to run the tracing app haha. I'm hoping to get this in this week or early next, but I'm trying to prioritize closing some of the other Windows Terminal bugs first.

@DHowett-MSFT
Copy link
Contributor

@codeofdusk sorry about the confusion here: the 21H1 milestone end date was set incorrectly. Things are a lot less dire than “we need to fix all the UIA bugs in the next two days.”

@codeofdusk
Copy link
Contributor

Excellent news!

@codeofdusk
Copy link
Contributor

@carlos-zamora Any updates on this PR? Were you able to address the issues with your machine and outstanding review comments? Thanks!

@carlos-zamora
Copy link
Member Author

@carlos-zamora Any updates on this PR? Were you able to address the issues with your machine and outstanding review comments? Thanks!

Now that Build is over, time to get back to this one 😊. Getting the traces and fixing the build today.

@carlos-zamora
Copy link
Member Author

@carlos-zamora Any updates on this PR? Were you able to address the issues with your machine and outstanding review comments? Thanks!

Now that Build is over, time to get back to this one 😊. Getting the traces and fixing the build today.

And another problem came up with recording the traces. Baby steps. This'll get done soon, sorry Bill haha.

@codeofdusk
Copy link
Contributor

Thanks for looking into it!

Also, could you please look into #5481?

@DHowett
Copy link
Member

DHowett commented May 21, 2020

@codeofdusk We'll look into it -- Carlos is assigned, but that does not indicate that it's in his immediate list of things to look at. We're finally coming off the v1 release cycle for Terminal and will have time in the future to evaluate conhost issues.

@ghost ghost added Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) labels Jun 10, 2020
@carlos-zamora carlos-zamora force-pushed the dev/cazamor/acc/ch/word-nav-perf branch from 78ebaca to 76fcc51 Compare June 10, 2020 18:50
@codeofdusk
Copy link
Contributor

What is the current status of this PR?

@zadjii-msft zadjii-msft added the Needs-Second It's a PR that needs another sign-off label Sep 30, 2020
@ghost ghost requested review from miniksa and DHowett September 30, 2020 19:09
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to have shaped up into something like we wanted it to. Can you change the name to something like "constrain a11y to the touched viewport"

consider that SEARCH uses this function (!) which could be problematic.

@codeofdusk
Copy link
Contributor

Also, how does this PR relate to #6986?

@carlos-zamora carlos-zamora changed the title Improve word navigation perf in ConHost Constrain a11y word nav to the virtual bottom Sep 30, 2020
@carlos-zamora
Copy link
Member Author

Also, how does this PR relate to #6986?

Here, we're making it easier to find the last non-space character (and the last word, by extension).

#6986 is an architectural change to treat the last non-space character as the end of the buffer. This change should make it a bit easier to accomplish that in a performant way.

@microsoft-github-updates microsoft-github-updates bot changed the base branch from master to main October 22, 2020 00:27
@zadjii-msft zadjii-msft removed the Needs-Second It's a PR that needs another sign-off label Mar 29, 2021
@carlos-zamora
Copy link
Member Author

Closing. See #7000 (comment) for more details.

I'll revive this PR once I actively start working on UIA again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Accessibility Issues related to accessibility Issue-Bug It either shouldn't be doing this or needs an investigation. Priority-1 A description (P1) Product-Conhost For issues in the Console codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UIA: delay when reaching prompt with word navigation
6 participants