-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Accessibility: Keyboard shortcuts to set start and end selection #95894
Comments
well makes sense to me, although there are features like expand selection etc. I also have problems with selecting nested blocks etc, and expand selection seems to work for this case, although I'd say you have to be a bit careful to verify what it's selecting. |
For an example of an implementation of this look at notepad++. Begin/end selection is an option in the context menu when in a file. I find this very useful when needing to copy large blocks of text. |
This feature is my consumer dream in any and every editor I use. |
well currently I am learning to do it this way: point at the beginning of, say, an if. select the whole line and next one because of the brace (in c# brace is usually below the if) and then use the expand selection feature, your selection should expand to the closing brace of this exact block. |
If it gets implemented then it will be very beneficial for productivity. |
The one old standard - used to use it in things like visual interdev and VS.Net 2005, etc., if remember correctly was purely F8 to mark start of selection, and then navigate around code however you like, and then hit shift + F8, and it would mark the whole block from start marker to end marker |
yeah. unfortunately f8 is taken. :) Also I prefer shortcuts without function keys as they are quite far in the kbd. |
Thanks for feedback and yes it will behave just like that: I am not sure if there will be a good feault keyboard shortcut, I will try to find something with F8 in the mix. |
Hahah, when I was very young, in the late 1980s, there was this program under both MS-DOS and CP/M called WordStar. It had layered keyboard commands, and two of them were CTRL+K, b to mark the start, and CTRL+K, k to mark an end of a block. This was the old equivalent of text selection. Borland's Turbo Pascal 3.0, the first true IDE I used, had a similar command set, which made the learning curve very flat. :-) I noticed immediately that CTRL+K is used for several layered commands in VS Code as well, so we could maybe leverage that. |
Yeah it might make sense to use the same command actually and the same shortcut so it is just a toggle, would make the whole thing more simple. Since why would you start a selection if you are already in a selection? |
The one small, not too important reason why some people might like to have separate commands would be if they'd initialised selection, and, marked the starting point, but, now wanted to shift it to somewhere else. Wouldn't really cause issues, but, they'd then need to do something like ctrl +K, move to next point, ctrl +K, and then ctrl +K to re-mark it as start? Jacob Kruger |
I was thinking the same thing. The separate commands for start and end selection do make sense for the case where one needs to be adjusted multiple times. |
Ok makes sense, two seperate commands it is. Thanks for feedback. |
@isidorn Implementation wise, I also think this could be implemented with two commands. The first one would be "set selection anchor" and would add an editor decoration at the current position. Using a decoration would make sure that the anchor stays with the surrounding text even if there are edits in the file. The second one, "select from anchor to position" would read up that decoration and create a selection in between. A third command could be added as well, "jump to anchor", which might be helpful to kind of "save a position" and then go reading around, and then jump back to it. Not sure if that would be useful, just a thought. |
Oh I could totally see myself use this a lot of times! A big 👍 for that! |
@alexdima good idea to use the decoration as an implementation detail. And the "Go to anchor" command makes a lot of sense. My idea for command naming:
Ideas on naming welcome. |
Me too! |
@alexdima Ok, I plan to create a The only alternative name I have is to use "Mark" instead of "Anchor". Though Anchor works fine for me, I like it for its uniqueness. Feedback on naming very welcome |
We have introduced three commands:
Please try it out in VS Code insiders from Tuesday and let us know how it behaves for you. |
Also please provide feedback if you would like confirmation once the anchor is set. Should we announce "Selection Anchor Set"? |
Probably " Anchor placed" or similar would be good to announce, just something short. |
Yup, agree with what @zersiax said. |
Thanks for feedback. We now announce "Anchor set". |
@isidorn It seems that the announcement "anchor set" only happens the first time that the command "Set Selection Anchor" is used. From the second time on, nothing is announced by the orca. |
@jvesouza thanks for feedback. The issue here is that we update the aria-live region, from "anchor set" to again "anchor set". Orca does not see detect difference in the content and does not read anything. |
@isidorn And if the command also announced the position? |
@jvesouza that would fix it. Good suggestion. Let me push that change. |
@jvesouza I have pushed a fix for this as you suggested, try it out from Thursdays vscode insiders and let me know what you think. |
@isidorn It was great, thanks. |
This works amazingly well, thank you! I was trying to use the "Go to Selection Anchor" command without setting a keystroke by using it from the quick picker. But it doesn't show up when I search for anchor. |
My bad, I just realized that the command list is smart enough to not offer that as an option if no anchor is present. |
@Neurrone yeah, we only show the command when it is applicable - when an anchor was set. |
@isidorn Can't we start selection automatically after command "Set Selection Anchor"? This way we won't need to use "Select From Anchor to Cursor" at all. |
@tomaik can you sketch outthe exact scenario? I fail to see what you mean exactly. |
Current implementation: Proposal: But now I get your point that this won't work for screen reader so it should be separate feature. |
Agree with @zersiax . The purpose was to reduce the verbiage screen readers issue when text is being selected. Also, not having the selection indicator on the braille display certainly helps with quickly finding the end point of the selection, before actually making it. |
@tomaik thanks for the suggestion, but as @MarcoZehe and @zersiax point out the current approach has more upside. |
The way selection currently works in VS Code requires you to hold down the shift key while holding down the arrow keys or using "Home", "End" and other such keys to contiguously select blocks of text/code.
While this works for most cases, this can become rather cumbersome for screen reader users when large amounts of code need to be acted on at once, e.g. copied, deleted etc.
The main cause of this is that screen readers pretty much require keyboard shortcuts to be used to get anything done. Quickly checking down a few lines (screen readers only see one line at a time), checking context, various other things are pretty much impossible while you are trying to select a large piece of code.
This is especially painful, for example, when you have a large amount of dummy HTML that needs to be replaced by a dynamic loop. Checking if you managed to get 6 levels worth of nested divs rather than that one outer div you didn't mean to highlight becomes an exercise in frustration.
A way around this problem is to, rather than depend on a held down key for contiguous selection, use a single keypress to mark the beginning and another to mark the end of the wanted selection. Once both points are set, the text in between those points is highlighted and can then be acted on.
This frees the keyboard up to , for example, move around the file, etc. without ever losing your selection
@isidorn requested to be notified of this feature request being created.
The text was updated successfully, but these errors were encountered: