nvda icon indicating copy to clipboard operation
nvda copied to clipboard

In web browsers, do not eat control+c when no selection is detected (#9833)

Open JulienCochuyt opened this issue 6 years ago • 19 comments

Link to issue number:

Fixes #9833

Summary of the issue:

In web browsers, a selection made using a pointing device is not copied to clipboard when pressing control+c

Description of how this pull request fixes the issue:

Send back the gesture if it is either control+c or control+insert. I guess this avoids issues if the script has been assigned alternative gestures, such as a braille one.

Testing performed:

Successfully tested in latest Firefox and Chrome.

Known issues with pull request:

Could other CursorManager uses be badly affected?

Change log entry:

Section: Bug Fixes In web browsers, NVDA no longer blocks control+C from copying text selected with the mouse.

JulienCochuyt avatar Jun 27 '19 15:06 JulienCochuyt

@JulienCochuyt: Could you please add a changelog entry to the PR description, but without "eating something". Because maybe the end user will get hungry after reading this changelog entry. 😉 Thanks.

DrSooom avatar Jun 30 '19 20:06 DrSooom

@JulienCochuyt: Could you please add a changelog entry to the PR description, but without "eating something". Because maybe the end user will get hungry after reading this changelog entry. 😉 Thanks.

Done. Feel free to propose a better way of phrasing the entry.

JulienCochuyt avatar Jun 30 '19 22:06 JulienCochuyt

2282dec: Rebased onto latest master

JulienCochuyt avatar Jul 15 '19 14:07 JulienCochuyt

@JulienCochuyt In the issue referenced above you wrote;

If no selection is detected, send control+C to the application and check whether clipboard content has changed before reporting either "No selection" or "Copied to clipboard". This approach might still give false negatives if the text are identical or lead to hassle with lengthy clipboard contents or contents other than text.

Have you tested this approach? For users especially beginners reporting 'no selection' when copying was actually successful would be very confusing.

lukaszgo1 avatar Aug 12 '19 18:08 lukaszgo1

@JulienCochuyt In the issue referenced above you wrote;

If no selection is detected, send control+C to the application and check whether clipboard content has changed before reporting either "No selection" or "Copied to clipboard". This approach might still give false negatives if the text are identical or lead to hassle with lengthy clipboard contents or contents other than text.

Have you tested this approach? For users especially beginners reporting 'no selection' when copying was actually successful would be very confusing.

No, due to the mentioned potential hassles. My preferred behavior would be to suppress the "No selection" message altogether, if others agree. The change proposed here is only the least intrusive I could find that fixes the issue.

JulienCochuyt avatar Aug 13 '19 07:08 JulienCochuyt

Rebased onto latest master

JulienCochuyt avatar Aug 13 '19 12:08 JulienCochuyt

  1. More importantly, ctrl+c is eaten by cursor managers on purpose. Peopel are currently expected to pass ctrl+c through to the application.

I hardly understand why the UX is thus changed when using a CursorManager, while the end user should not care about the underlying implementation. This is almost off topic, but I'd be rather interested if you could kindly find the time to explain how that choice was made in the first place.

I've done some quick testing with the keyboard, and I'm pretty sure this alternative will work, at least for Firefox:

  1. If there is no selection within the cursor manager, create a textInfo for treeInterceptor.rootNVDAObject
  2. If this selection is not collapsed, then there is some selection in the document that has been made visually.
  3. In this case, report something interesting.

This is an interesting approach. Successfully tested with Firefox and Chrome. Strangely enough (at least to me), the TextInfo retrieved that way does not contain the selection, but rather "\ufffc\ufffc\ufffc\ufffc\ufffc\ufffc\ufffc" and has offsets (2, 3) if there is a selection, (3, 3) otherwise.

JulienCochuyt avatar Sep 13 '19 17:09 JulienCochuyt

@leonardder: Would you have some time to please review the last changes on this PR? The issue was raised once again in #10295.

JulienCochuyt avatar Sep 28 '19 15:09 JulienCochuyt

Strangely enough (at least to me), the TextInfo retrieved that way does not contain the selection, but rather "\ufffc\ufffc\ufffc\ufffc\ufffc\ufffc\ufffc" and has offsets (2, 3) if there is a selection, (3, 3) otherwise.

It would be required to make a Mozilla Compound TextInfo to get the text in the selection, I think.

LeonarddeR avatar Sep 28 '19 16:09 LeonarddeR

PR introduces Flake8 errors :astonished:

See test results for Failed build of commit b38c7704c5

AppVeyorBot avatar Sep 30 '19 06:09 AppVeyorBot

Strangely enough (at least to me), the TextInfo retrieved that way does not contain the selection, but rather "\ufffc\ufffc\ufffc\ufffc\ufffc\ufffc\ufffc" and has offsets (2, 3) if there is a selection, (3, 3) otherwise.

It would be required to make a Mozilla Compound TextInfo to get the text in the selection, I think.

I'm not yet aware of the use of these. Wouldn't this mean to move the fix from CursorManager to some Mozilla-specific class while all browsers are affected? Or is there a mean to create a CompboundTextInfo in a generic way?

JulienCochuyt avatar Sep 30 '19 06:09 JulienCochuyt

Something like this:

from NVDAObjects.IAccessible.ia2TextMozilla import MozillaCompoundTextInfo
info = MozillaCompoundTextInfo(self.rootNVDAObject, textInfos.POSITION_SELECTION)

Note that CompoundTextInfo is very performance heavy

LeonarddeR avatar Sep 30 '19 06:09 LeonarddeR

Something like this:

from NVDAObjects.IAccessible.ia2TextMozilla import MozillaCompoundTextInfo
info = MozillaCompoundTextInfo(self.rootNVDAObject, textInfos.POSITION_SELECTION)

Note that CompoundTextInfo is very performance heavy

Thanks. But I guess this, if confirmed, would not fit in the generic CursorManager and thus solve the issue only for Mozilla-based browsers… ?

JulienCochuyt avatar Sep 30 '19 06:09 JulienCochuyt

I think either Mozilla or Chromium based. The Mozilla name is a bit misleading here, probably because Firefox came first with their IA2 implementation. For IE, I Wouldn't bother that much, personally.

LeonarddeR avatar Sep 30 '19 06:09 LeonarddeR

I think either Mozilla or Chromium based. The Mozilla name is a bit misleading here, probably because Firefox came first with their IA2 implementation. For IE, I Wouldn't bother that much, personally.

Re IE, note that browsable messages are IE-based. Still, I'll try to test moving the fix to virtualBuffers.Gecko_ia2 and use a Mozilla.CompboundTextInfo there.

JulienCochuyt avatar Sep 30 '19 07:09 JulienCochuyt

I guess we should be able to find out whether there is a visual selection in IE as well.

LeonarddeR avatar Oct 01 '19 09:10 LeonarddeR

It seems like momentum was lost on this PR. It looks like there are still a number of outstanding questions here. I'd like to be able to progress this PR, I think it is one of the true thorns for low-vision users or A11Y testers in the default configuration.

feerrenrut avatar Aug 10 '20 10:08 feerrenrut

this will help a lot low vision users. If NVDA isn't able to tell wheather copy was successful, NVDA could say: Maybe visual selection copied, please check success.

bdorer avatar May 12 '21 22:05 bdorer

We definitely still get asked about this often. It would be great to have a resolution.

Qchristensen avatar Jul 21 '22 21:07 Qchristensen

Apologies for ignoring this pr for so many years! However, after considering this further, I believe that this may cause confusion or unexpected behavior for users, so I am unwilling to take this at the moment.

  • The blind user is currently unaware if a real non-browseMode selection has been made.
  • There are workarounds for the vision impaired / sighted user when selecting with a pointing device: right click and copy, or pass key through and control+c. If in the future we better support the underlying selection (See the new IAccessibleTextSelectionContainer in IAccessible2), then perhaps we can consider this, but only if the underlying selection is somehow exposed to the blind user.

michaelDCurran avatar Jun 10 '23 00:06 michaelDCurran