Skip to content

Suppress duplicate Visual Studio tooltips#11841

Merged
feerrenrut merged 8 commits into
nvaccess:masterfrom
LeonarddeR:tooltips
Nov 27, 2020
Merged

Suppress duplicate Visual Studio tooltips#11841
feerrenrut merged 8 commits into
nvaccess:masterfrom
LeonarddeR:tooltips

Conversation

@LeonarddeR

Copy link
Copy Markdown
Collaborator

Link to issue number:

Closes #11611

Summary of the issue:

In Visual Studio, the tooltip opened event is fired twice for IntelliSense popups.

Description of how this pull request fixes the issue:

In an overlay class, ignore the event if it was fired less than 0.2 seconds ago and had the same name.

Testing performed:

Tested that tool tips are only announced once.

Known issues with pull request:

None

Change log entry:

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit b62161a4c8

@feerrenrut

Copy link
Copy Markdown
Contributor

Can you expand on how you chose 0.2 seconds?

Comment thread source/NVDAObjects/UIA/VisualStudio.py Outdated
newText = self.name
newTime = time.time()
self.__class__._lastToolTipOpenedInfo = (newText, newTime)
if newText == oldText and oldTime is not None and (newTime - oldTime) < 0.2:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this really needs a comment to explain why this is done.

For instance, it is probably worth pointing out that a user may intentionally be trying to hear the same tooltip twice, hence the 0.2 seconds. I think the value could be larger (eg 1 second). Given that the text must be equal consecutively, we should look to approach the limit of how rapidly a user could ever intentionally try to trigger the same tooltip twice in a row.

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

Can you expand on how you chose 0.2 seconds?

This was by trial and error, I was looking for a small window. I can give a more in depth rationalisation based on logging if you desire.

I think the value could be larger (eg 1 second).

I was just looking for the smallest window. This was actually mostly copied from the should accept UIA live region code, however there, the interval was 0.5 seconds. I could think of situations where one would rapidly arrow back and forth between IntelliSense items, so my feeling says one second might be too much.

@feerrenrut

Copy link
Copy Markdown
Contributor

I could think of situations where one would rapidly arrow back and forth between IntelliSense items

In this case the newText == oldText test should fail though, right?

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

I could think of situations where one would rapidly arrow back and forth between IntelliSense items

In this case the newText == oldText test should fail though, right?

Not in the following situation:

  1. Item a has focus, tool tip is shown
  2. User presses down arrow, item b is focused but tool tip takes a little while to come up
  3. Before the tool tip comes up, user presses up arrow. Item a gets focus again, but tool tip is ignored if the time range is too long.

@feerrenrut

Copy link
Copy Markdown
Contributor

Ok, yes that situation needs to be considered too.

Could we tie this to input somehow? EG make this longer timeout, but reset when there is keyboard input?

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

Could we tie this to input somehow? EG make this longer timeout, but reset when there is keyboard input?

I'm afraid that's pretty hacky. Not sure whether to register the reset, then.

@feerrenrut

Copy link
Copy Markdown
Contributor

I don't think there is any other reasonable heuristic we can use to determine whether the tooltip showing is the user's intention. But basing this solely on keyboard input would exclude low-vision mouse users.

I think for now we can accept this PR the way it is, hopefully this workaround improves the outcome most of the time. For users on slower computers (or under-load or with different tooltip settings) the timeout may not be appropriate. Perhaps one step better is to make the timeout an advanced configuration.

There is a certain argument that problems like this should be left exposed so they are more obvious and get fixed in the 3rd party application (Visual Studio in this case), however we should be able to replicate this issue with accEvent and request a fix from Microsoft.

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

There is a certain argument that problems like this should be left exposed so they are more obvious and get fixed in the 3rd party application (Visual Studio in this case),

Agreed, but it is pretty irritating for daily users.

however we should be able to replicate this issue with accEvent and request a fix from Microsoft.

I will try to contact Dante Gange about this.

Comment thread source/NVDAObjects/UIA/VisualStudio.py Outdated
Co-authored-by: Reef Turner <feerrenrut@users.noreply.github.com>
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 3eb7e229d3

feerrenrut
feerrenrut previously approved these changes Nov 27, 2020

@feerrenrut feerrenrut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @LeonarddeR

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 257b3afb43

feerrenrut
feerrenrut previously approved these changes Nov 27, 2020
@feerrenrut feerrenrut merged commit ba21333 into nvaccess:master Nov 27, 2020
@nvaccessAuto nvaccessAuto added this to the 2020.4 milestone Nov 27, 2020
@LeonarddeR LeonarddeR deleted the tooltips branch August 23, 2025 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Visual Studio: IntelliSense tooltips reported twice

4 participants