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

support code folding with screen reader support enabled #43262

Closed
OSadovy opened this issue Feb 8, 2018 · 24 comments
Closed

support code folding with screen reader support enabled #43262

OSadovy opened this issue Feb 8, 2018 · 24 comments
Assignees
Labels
a11ymas Issue from accessibility team accessibility Keyboard, mouse, ARIA, vision, screen readers (non-specific) issues accessibility-sla Accessibility issue which have to be fixed or lowered severity based on process editor-folding Editor code folding issues feature-request Request for new features or functionality on-testplan
Milestone

Comments

@OSadovy
Copy link

OSadovy commented Feb 8, 2018

Issue Type

Bug

Description

  1. Open VS Code with NVDA Screen Reader running
  2. open some source code, I used python file
  3. Navigate to the class definition, e.g. class A:
  4. press ctrl+shift+[
  5. navigate downward

Actual result:
the class will not be collapsed, cursor goes to next line in the file

Expected result:
Cursor should navigate to the next definition at the same level, e.g. class B:

additional info:
I'd like to be able to skip long blocks of code. Please make code folding work with screen reader enabled.

VS Code Info

VS Code version: Code 1.20.0 (c63189d, 2018-02-07T17:09:39.780Z)
OS version: Windows_NT x64 10.0.16299

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz (4 x 2904)
Memory (System) 15.88GB (8.27GB free)
Process Argv C:\Program Files\Microsoft VS Code\Code.exe
Screen Reader yes
VM 0%
Extensions (2)
Extension Author (truncated) Version
Go luk 0.6.73
python ms- 2018.1.0
Reproduces without extensions
@vscodebot vscodebot bot added the new release label Feb 8, 2018
@octref octref added editor-folding Editor code folding issues accessibility Keyboard, mouse, ARIA, vision, screen readers (non-specific) issues and removed new release labels Feb 12, 2018
@aeschli aeschli assigned alexdima and unassigned aeschli Feb 12, 2018
@alexdima alexdima added the feature-request Request for new features or functionality label Apr 19, 2018
@alexdima alexdima added this to the Backlog milestone Apr 19, 2018
@alexdima alexdima removed their assignment Apr 19, 2018
@isidorn
Copy link
Contributor

isidorn commented Aug 23, 2019

After discussions with @alexandrudima he explained that we disable code folding because there is no good way to communicate to the screen reader that a code area is folded. Another issue is that we are not properly reading out the line numbers so the user is not aware that there is a big change in line numbers and he can not infer that he just navigated over a folder area.

Also the code folding + is not accessible via keyboard.
Not sure if just having folding commands in the command palette is enough for screen reader users.

One way how we could communicate to the user that a code area is folder is via alerts. However that does not cover the case when the user should be notified that a code area is unfolded and can be folder. Requires more thinking...

@isidorn isidorn self-assigned this Aug 23, 2019
@isidorn isidorn modified the milestones: Backlog, On Deck Aug 23, 2019
@Neurrone
Copy link

I think having proper UIA support in Chromium would make this a lot easier, since it allows exposure of rich formatting data of text ranges. If I'm not mistaken, Microsoft is contributing code to Chromium to add support for UIA so that the new Edge will work well with Narrator.

@OSadovy
Copy link
Author

OSadovy commented Aug 25, 2019

while uia support would be the best option, in the due time we might consider allowing the user to decide whether they can tolerate issues mentioned (lack of proper feedback & line numbers confusion) by maybe introducing a setting which will override current default to disable folding entirely. Another way to overcome current lack of folding with screen reader might be to introduce commands for jumping to next/previous blocks of folding of different level (without actually folding anything in the editor). should I create an issue for this?

@isidorn
Copy link
Contributor

isidorn commented Aug 26, 2019

@OSadovy feel free to create new feature requests for folding. However please first double check if there are currently no folding commands in the command palette that cover this - since there are quite some.

@RobGallo
Copy link

In Visual Studio, I believe folded code is indicated with an elypsis (...) at the end. Sometimes, the text of the spoken/Brailled line will include more than one actual line.

It's okay that the line numbers aren't read out. Those would get in the way of interesting content very quickly.

And for the short term, it might be better to allow folding as long as there is an easy way to unfold everything in a file. That would be my preference. I find folding very useful in navigating code.

@isidorn
Copy link
Contributor

isidorn commented Aug 26, 2019

@RobGallo thanks for the feedback.
@alexandrudima just enabled code folding even when screen reader is detected. You can try that out from Tuesday's vscode insiders.

@RobGallo And yes there is an easy way to unfold everything F1 > Unfold all. Folding has a lot of commands in the command palette, check them out.

I will assign this issue to September so I look into what further improvements we could do regarding folding.
Feedback is very welcome so I know what I should focus on.

@isidorn
Copy link
Contributor

isidorn commented Oct 22, 2019

I have tried this out, and my initial feeling is that when the text is unfolded we should not announce anything. The points where code can be folded can be infered by the user.
The issue is that when the code is folded the user can skip over it and there is no way for the user to know he skipped over quite some lines. The only way for him to be aware of this is if he checks his line numbers activly via ctrl+G.

Overall I think this would be a good experience as it is if we had microsoft/monaco-editor#410
However since we do not have that. We should let the user know that he just navigated over an expanded area. Two ideas:

  • We put the collapsed folding decoration ... somehow in the hidden text area. Such that the ... is read to the user at the end of the line
  • We do an aria.alert when a user navigates over an area which is folded

@alexandrudima let me know what you think or if you have a better idea

@isidorn isidorn modified the milestones: October 2019, November 2019 Oct 22, 2019
@alexdima
Copy link
Member

@isidorn

I don't think writing ... to the textarea is helpful because it is possible to open a regular file without folding which contains ... as content. So there wouldn't be any clear way to communicate which one is real file content and which one is fake content to stand in for folded text.

Since we don't have any semantic way to communicate folded regions, I don't see anything else than possibly using aria.alert, but even that I'm not sure when it would alert and what it would say.

@jhomme
Copy link

jhomme commented May 8, 2020

Hi,

Let me lay out my case for letting the screen reader user control their own destiny with folding. I think I qualify, because of having used a screen reader since about 1987. Here goes.

When writing code, the screen reader user should know which lines are folded by context. For example, in Python, the user would read words such as if, else, while, class, function, etc., and the lines would end with colons, unless there was a comment. If we arrow up or down and encounter another line with a keyword like the above, we know we have jumped across a fold. Python also has the extra benefit of indentation. If the screen reader can speak indentations, we know which level we are on when we land on a line.

With C-like languages, we would encounter similar words, but the punctuation would be different. We may or may not encounter a { character at the end of the line that marks the fold, but I do not see this as a problem either, because, again, we know by context. With these languages, indentation is not a factor, except for code-formatting reasons, visually. With the C-like languages, though, I feel that if VS Code would indicate which level we are examining, this would be very nice to have, and almost essential. This is because the user can only count on knowing levels if the code is formatted and the screen reader is set up to react to the formatting. A lot of us format code with tabs, rather than spaces for that reason. It's easy: one tab character per level.

With JAWS, by default, there is a generic indentation speaking setting that either counts tabs or spaces. the user can undertake setting up what is called a sound scheme and force JAWS to say specialized messages or, if they are lucky enough to be able to hear musical tones and associate them with levels, play notes that were sampled from a piano. IF the user is using spaces, they must do the math quickly, and equate spaces with levels. This is not the worse thing in the world, but why increase the cognative overload when you do not have to.

NVDA can indicate indentation by counting tabs or spaces. It can also play tones, but the tones are not tuned to, for instance, the C Major scale. For completeness, NVDA can speak indentation and play tones at the same time. Someone could also come up with an add-on that plays musical tones.

Then we have VoiceOver, which I have not tried in VS Code yet, but have found that in other editors, also says the number of spaces or tabs, when Punctuation is set to all, as needs to be the case with the other screen readers, but when we write code, we must do that anyway.

I rest my case. :)

@isidorn
Copy link
Contributor

isidorn commented May 8, 2020

@jhomme thanks for the feedback. We plan to enables this in the future.
One step towards this would be #97154
So we would be able to announce "details" for a line of code. And one of those details would be folding state.

@jhomme
Copy link

jhomme commented May 8, 2020

Hi,
The techniques on this page may provide food for thought.

https://www.w3.org/WAI/WCAG21/Understanding/status-messages

@andadapt
Copy link

Hi,

Is it possible to add an audio notification for folded state?

So when i navigate to a folded line a beep or beep or indeed any sound is used as a notification point?

@isidorn
Copy link
Contributor

isidorn commented Feb 22, 2021

@andadapt our approach in general is that VS Code does not produce custom sounds, we try to annotate everything and leave up the creation of sound to the screen reader.
However we could do a short announcement once you navigate on a folded line: "Folded".

I am open for other ideas, however to have a rich experience we would probably need this #97154

@MarcoZehe maybe you have some creative ideas?

@MarcoZehe
Copy link
Contributor

Unfortunately, I don't. Such announcements always run the risk of drowning out the actual reading out of the line, e. g. you navigate onto the line with the arrow keys, and whichever fires first, e. g. the announcement or the reading of the line the cursor lands on, interrupts the other. The only true solution would be rich annotations.

@fsteffi
Copy link

fsteffi commented Aug 31, 2021

GitHubTags:#A11y_VSCode;#A11ySev1;#A11yTCS;#DesktopApp;#Visual Studio Code Client;#keyboard;#WCAG2.1.1;#Win10;#VisualStudioCode-Win32-Apr2021;#A11yMAS;

@isidorn isidorn added the accessibility-sla Accessibility issue which have to be fixed or lowered severity based on process label Oct 14, 2021
@sana-ajani
Copy link
Contributor

However we could do a short announcement once you navigate on a folded line: "Folded".

@isidorn could the screen reader announce "Folded" or "Unfolded" when the user uses the keyboard shortcut to fold/unfold a region? That is also what Sublime Text reads out when you use the shortcut. I checked with VS, and they have a keystroke that lets users know what adornments are available on the line (e.g. Errors, Warnings, Quick Actions, Breakpoints, etc...) and collapsed regions are also included in that.

@isidorn
Copy link
Contributor

isidorn commented Nov 11, 2021

@sana-ajani thanks for trying it out! I think the problem here is not that it user is not aware of the state after they execute an action, but if they later return to that location how will we announce that something is folded. Can you check what Sublime and VS announce in that case?

I like the VS approach of command to announce adornments, but that is a workaround, which we might need to introduce as well.

@sana-ajani
Copy link
Contributor

@isidorn at least with VoiceOver, Sublime doesn't announce that you're on a folded region if you come back to that location. In VS, when the user reads the text via navigation or keyboard command, they detect if the line contains a collapsed region and then append that to the text that’s read out i.e. "public class Foo (contains collapsed region)"

@isidorn
Copy link
Contributor

isidorn commented Nov 12, 2021

@sana-ajani the VS behaviour is proper. The technical problem for us is that we can not easily append text to the content of the editor, we could also announce "contains collapsed region" using an alert however that has the problems as Marco pointed out above.
Thus we should go with the producing a short sound and we are working on that. In the meantime can you file an exception for this? Thanks

@OSadovy
Copy link
Author

OSadovy commented Nov 13, 2021 via email

@RobGallo
Copy link

I do not favor the concept of having the entire contents of a folded region rendered when one navigates to the line with the fold. The idea of folding is to move information that isn't relevant at the moment out of the way -- to keep cognitive load down. Having content which isn't relevant rendered is antithetical to that.

@isidorn
Copy link
Contributor

isidorn commented Jan 24, 2022

Code folding is now enabled with screen readers.
We play a distinct sound once the cursor is on a line where the block of code is folded.
Please try it out with latest vscode insiders https://code.visualstudio.com/insiders/ and let us know what you think, thanks!
We are also very much interested in the feedback for the sound we play.

fyi @hediet @gino-scarpino

@isidorn isidorn closed this as completed Jan 24, 2022
@isidorn isidorn modified the milestones: On Deck, February 2022 Jan 24, 2022
@isidorn isidorn added on-testplan a11ymas Issue from accessibility team labels Jan 24, 2022
@isidorn isidorn modified the milestones: February 2022, January 2022 Jan 28, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a11ymas Issue from accessibility team accessibility Keyboard, mouse, ARIA, vision, screen readers (non-specific) issues accessibility-sla Accessibility issue which have to be fixed or lowered severity based on process editor-folding Editor code folding issues feature-request Request for new features or functionality on-testplan
Projects
None yet
Development

No branches or pull requests