Skip to content

Added mouse wheel scrolling commands#16462

Merged
seanbudd merged 26 commits intonvaccess:masterfrom
cary-rowen:simulateMouseWheel
Jun 7, 2024
Merged

Added mouse wheel scrolling commands#16462
seanbudd merged 26 commits intonvaccess:masterfrom
cary-rowen:simulateMouseWheel

Conversation

@cary-rowen
Copy link
Contributor

@cary-rowen cary-rowen commented Apr 30, 2024

Link to issue number:

Closes #15484

Summary of the issue:

Some dynamically loaded web pages and desktop applications, such as Dism++, only allow scrolling via the hardware mouse wheel to display more content. NVDA can only interact with these through screen review mode. However, to load more items, mouse wheel usage is required.

Description of user facing changes

This pull request allows users to simulate mouse wheel scrolling through gestures. Added four commands with no gestures assigned:

  • Scroll up at the mouse position
  • Scroll down at the mouse position
  • Scroll left at the mouse position
  • Scroll right at the mouse position

Description of development approach

I created a function within mouseHandler called scrollMouseWheel, which scrolls the mouse wheel either vertically or horizontally, controlling the scroll direction and amount. For more information about mouse events, see WM_MOUSEWHEEL.
It's important to note that this function limits the scrolling per execution to winUser.WHEEL_DELTA (120) or less. Although this PR performs the standard scrolling amount of 120 each time, add-on developers might opt for a larger amount, as done by @beqabeqa473 in mouseWheelScrolling.

Testing strategy:

I tested the following cases:

Go to System Settings > Devices > Mouse > Roll the mouse wheel to scroll:

  • Multiple lines at a time
  • One screen at a time
  1. NVDA+Ctrl+V opens the voice settings panel and simulates mouse wheel scrolling on slider controls such as speed and volume.
  2. Try simulating mouse wheel scrolling in Microsoft Excel and visually verify that the scrolling is as expected.

Known issues with pull request:

Microsoft Excel correctly responds to system settings, whether "Multiple lines at a time" or "One screen at a time".

However, the slider in the NVDA voice settings panel always scrolls at the standard amount of 120 and does not respond to system settings, but is consistent with the behavior of physical mouse wheel.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@cary-rowen cary-rowen requested review from a team as code owners April 30, 2024 03:14
@cary-rowen
Copy link
Contributor Author

Here are some things I'm not sure about yet:

  1. Due to PR merge freeze until Monday May 6 AEDT #16419 I don't know where to put the change log entry.
  2. Is it necessary for scrolling gestures to play a beep or ui message when scrolling is performed to inform the user that the operation has been performed?

@AppVeyorBot
Copy link

See test results for failed build of commit ac5a0ac7a4

@Adriani90
Copy link
Collaborator

@cary-rowen nice feature, thanks very much for this great contribution.
You write:

  1. Due to PR merge freeze until Monday May 6 AEDT PR merge freeze until Monday May 6 AEDT #16419 I don't know where to put the change log entry.

I think 2024.2 will not take additional change log entris from alpha. But better we wait for NV Access confirmation on that.

  1. Is it necessary for scrolling gestures to play a beep or ui message when scrolling is performed to inform the user that the operation has been performed?

NVDA should read out what is under the mouse cursor, as it does when moving the mouse.
Beeps are not an option in my opinion, because you don't have any clue where the mouse scrolled if NVDA doesn't read anything out.

Also we need to test if the review cursor is moved properly when it follows the mouse. You can enable this in the review cursor settings. Did you test this already?

@CyrilleB79
Copy link
Contributor

Re the change log:
You will have to put it in the correct section (2024.3) when it is created in alpha.

@hwf1324
Copy link
Contributor

hwf1324 commented Apr 30, 2024

NVDA should read out what is under the mouse cursor, as it does when moving the mouse. Beeps are not an option in my opinion, because you don't have any clue where the mouse scrolled if NVDA doesn't read anything out.

Note that this is not the same behavior as actually scrolling the physical scroll wheel.
It does not actually report new content under the mouse when the screen is scrolled.

Copy link
Collaborator

@LeonarddeR LeonarddeR left a comment

Choose a reason for hiding this comment

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

As for the gestures, I would personally vote against gestures that do not involve the NVDA key. I'm also not convinced that these gestures need assignments by default. Both UIA and IAccessible2 have the ability to instruct objects to scroll into view.

That said, I think this is certainly a valuable feature!

@XLTechie
Copy link
Collaborator

XLTechie commented May 1, 2024 via email

@seanbudd seanbudd added this to the 2024.3 milestone May 1, 2024
@cary-rowen
Copy link
Contributor Author

Thanks to @LeonarddeR for the code review.

@LeonarddeR and @XLTechie

I assigned it a gesture with NVDA keys, NVDA+Windows+pageUp/Down hoping this would be more useful, I'd also like to hear what the community has to say.

Hi @Adriani90

NVDA should read out what is under the mouse cursor, as it does when moving the mouse.

This PR is intended to emulate the scroll wheel functionality on a physical mouse, which does not behave exactly like a mouse pointer.

@CyrilleB79

You will have to put it in the correct section (2024.3) when it is created in alpha.

No problem, I will do it.

@CyrilleB79
Copy link
Contributor

The need to scroll seems quite rare; personally, I would not have assigned it any keyboard shortcut.

@cary-rowen
Copy link
Contributor Author

Scrolling the wheel is probably rarer than moving the mouse pointer, I'd be willing to have the default gesture removed.

@AppVeyorBot
Copy link

See test results for failed build of commit 20ccf7889e

category=SCRCAT_MOUSE
)
def script_scrollMouseWheelDown(self, gesture):
mouseHandler.scrollMouseWheel(-winUser.WHEEL_DELTA, True)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
mouseHandler.scrollMouseWheel(-winUser.WHEEL_DELTA, True)
mouseHandler.scrollMouseWheel(-winUser.WHEEL_DELTA, isVertical=True)

@seanbudd seanbudd marked this pull request as draft May 6, 2024 06:26
@seanbudd
Copy link
Member

seanbudd commented May 6, 2024

Can you please update the description to reflect the latest changes e.g. note that the gestures are unbound

@script(
description=_(
# Translators: Input help mode message for mouse wheel scroll up command.
"Scrolls up the mouse wheel at the current mouse position"
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically, I think that you do not scroll the mouse but the window's content at the mouse position, e.g. you scroll a webpage.
English native speakers, please confirm.

Suggested change
"Scrolls up the mouse wheel at the current mouse position"
"Scrolls up at the current mouse position"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, most of the time it's not the mouse wheel itself that's scrolling, but rather the content on the screen (such as a web page or document) that moves in response to the mouse wheel's operation.
However, from a technical implementation perspective, this is the result of simulating the behavior of a mouse wheel scrolling.
The function doesn't move the content directly; it generates mouse wheel events that the system interprets as commands to scroll the content.
Can other native English speakers offer more advice on this?

Copy link
Member

Choose a reason for hiding this comment

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

Yes I think this terminology is better for these descriptions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean I don't need to make changes or should I take @CyrilleB79's suggestion?

Copy link
Contributor

Choose a reason for hiding this comment

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

@cary-rowen, if you are concerned by the fact that the function does not move the content directly, do not use scroll at all, because the function does not actually perform scrolling, it actually simulate wheel rotating.

Suggested change
"Scrolls up the mouse wheel at the current mouse position"
"Rotates up the mouse wheel at the current mouse position"

IMO, no need to mention "simulation", as done also for left/right mouse click. Indeed, assigning a keyboard or touch gestures already makes clear that the real action is not done by the physical mouse.

Copy link
Member

Choose a reason for hiding this comment

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

@Qchristensen - what are your thought on the changes from scrolling to rotating? I prefer scrolling and think its more common. Rotating to me seems to imply physical movement of the wheel, not the behaviour on screen.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that the verb "to scroll" is more common and probably more understandable.

Actually, my concern with the initial wording was that "to scroll up the mouse wheel" was not correct grammatically. Why not things like:

  • "scroll up at the mouse position" for descriptions / comments
  • "mouseScrollUp" for the script's name?

No matter if we do not mention the word "wheel", which create confusion or bad phrasing when used with "scroll".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No matter if we do not mention the word "wheel", which create confusion or bad phrasing when used with "scroll".

I don't entirely agree with this.

I have attached a Microsoft document before. Can we refer to some of the wording in it?

https://support.microsoft.com/en-us/topic/what-are-the-default-buttons-and-wheel-assignments-for-my-mouse-47f656a8-72d0-63ec-8d1d-dda7122bef6b

Copy link
Contributor

Choose a reason for hiding this comment

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

But "scrolling" is actually a key word present in the documentation you linked (first table, in the column "Action")

IMO, when possible, it's better to mention an action rather than a physical button, because there may be other ways to perform them.
For example:

  • use "scroll up/down" rather than "rotate the mouse wheel up/down" because there may be other way to perform these actions, e.g. with a touch pad.
  • use "scroll left/right" rather than "rotate the mouse wheel left/right because in Chrome you can scroll horizontally using shift + rotating vertically the mouse wheel.

),
category=SCRCAT_MOUSE
)
def script_scrollMouseWheelUp(self, gesture):
Copy link
Contributor

Choose a reason for hiding this comment

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

Idem:

Suggested change
def script_scrollMouseWheelUp(self, gesture):
def script_scrollUpAtMousePosition(self, gesture: inputCore.InputGesture) -> None:

@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label May 7, 2024
@@ -379,3 +379,32 @@ def unlockRightMouseButton():
# Translators: This is presented when the right mouse button lock is released (used for drag and drop).
ui.message(_("Right mouse button unlock"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know this is old, but...

Suggested change
ui.message(_("Right mouse button unlock"))
ui.message(_("Right mouse button unlocked"))

I would like to do the left one as well, but when expanding up to it, GH won't allow a change suggestion.

@cary-rowen
Copy link
Contributor Author

Thanks to @XLTechie for the English wording suggestion.

@cary-rowen cary-rowen requested a review from seanbudd May 15, 2024 07:35
@cary-rowen cary-rowen changed the title Add simulated mouse wheel feature Added mouse wheel rotation commands May 16, 2024
@cary-rowen
Copy link
Contributor Author

@seanbudd I think this is ready.

@Adriani90
Copy link
Collaborator

@cary-rowen has been there any testing with the visual highlighter on? What happens when the highlighters are enabled? Do they disappear from the screen when scrolling the wheel with the keyboard commands? Or do they get a new position?

@hwf1324
Copy link
Contributor

hwf1324 commented May 17, 2024

@cary-rowen has been there any testing with the visual highlighter on? What happens when the highlighters are enabled? Do they disappear from the screen when scrolling the wheel with the keyboard commands? Or do they get a new position?

I'm not testing it right now.
But visual highlighter not following the screen scrolling and moving in many cases is something that has been an issue before.
Update: For visual highlighter, the behavior of the physical mouse wheel and the simulated mouse wheel is the same, and neither of the highlighter indicators will change with it.

@cary-rowen
Copy link
Contributor Author

cc @Qchristensen
Can you give any further actionable suggestions?

@Qchristensen
Copy link
Member

Just looking at the User Guide change rather than the code comment, I see line 840 has:

|Rotates the mouse wheel up at the current mouse position|

I would go with "scroll", and yes I agree with "up" where it is in this sentence rather than where it was earlier in the conversation. While the previous suggestion of "Scroll up at the current mouse position" is shorter, I'm not against "Scroll the mouse wheel up" as it does indicate what is trying to be scrolled at this point, as opposed to the several other instances of scrolling commands in NVDA, eg:

@seanbudd seanbudd marked this pull request as draft May 23, 2024 03:24
@seanbudd seanbudd removed this from the 2024.3 milestone May 24, 2024
@cary-rowen cary-rowen changed the title Added mouse wheel rotation commands Added mouse wheel scrolling commands Jun 2, 2024
@cary-rowen cary-rowen marked this pull request as ready for review June 2, 2024 03:23
@cary-rowen
Copy link
Contributor Author

@Qchristensen
Can you review these changes to the doc?

@cary-rowen
Copy link
Contributor Author

Hi cc @seanbudd
I think this is ready.

Copy link
Member

@Qchristensen Qchristensen left a comment

Choose a reason for hiding this comment

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

Looks good, thanks Cary and everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Allow simulated mouse wheel scrolling

9 participants