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

feat: Allow more lines in hidden textarea to improve screen reader experience on Windows #5225

Merged
merged 25 commits into from
Jul 24, 2023

Conversation

akoreman
Copy link
Contributor

@akoreman akoreman commented Jun 28, 2023

Issue #, if available: #2164

Description of changes: Some Windows browsers and screen readers have trouble reading the content in the hidden textarea when navigating up/down.

This change allows more lines of text into the textarea to allow to improve the screen reader experience (without changing the default behavior).

This allows the cursor in the textarea to move lines up/down which makes the behavior in the hidden textarea closer to a 'normal' textarea. Monaco uses a similar approach and is generally considered to be ahead of Ace when it comes to screen reader compatibility.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Jun 28, 2023

Codecov Report

Patch coverage: 96.77% and no project coverage change.

Comparison is base (c731164) 87.23% compared to head (81d31de) 87.23%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5225   +/-   ##
=======================================
  Coverage   87.23%   87.23%           
=======================================
  Files         565      565           
  Lines       45248    45288   +40     
  Branches     6920     6929    +9     
=======================================
+ Hits        39470    39508   +38     
- Misses       5778     5780    +2     
Flag Coverage Δ
unittests 87.23% <96.77%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/keyboard/textinput.js 77.28% <95.65%> (+0.67%) ⬆️
src/editor.js 80.60% <100.00%> (+0.02%) ⬆️
src/keyboard/textinput_test.js 99.56% <100.00%> (+0.02%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@akoreman
Copy link
Contributor Author

akoreman commented Jun 28, 2023

This does seem to improve screen reader compatibility, there are some problems with the current implementation when copying text though. Issue should be fixed.

@akoreman akoreman changed the title [POC] Allow more lines in hidden textarea to allow cursor to move to improve screen reader feat: Allow more lines in hidden textarea to improve screen reader experience Jun 30, 2023
@akoreman akoreman marked this pull request as ready for review July 7, 2023 22:17
@akoreman akoreman changed the title feat: Allow more lines in hidden textarea to improve screen reader experience feat: Allow more lines in hidden textarea to improve screen reader experience on Windows Jul 11, 2023
if (value){
this.renderer.enableKeyboardAccessibility = true;
this.renderer.keyboardFocusClassName = "ace_keyboard-focus";

this.textInput.getElement().setAttribute("tabindex", -1);
// VoiceOver on Mac OS works best with single line in the textarea, the screen readers on
// Windows work best with multiple lines in the textarea.
this.textInput.setNumberOfExtraLines(useragent.isWin ? 3 : 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

what about linux?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question, I don't have quick access to a Linux desktop so I couldn't test this so I didn't want to change anything for Linux. The most used screen reader on Linux seems to be orca.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried on Ubuntu with orca, and to be honest, it's not great with either option but it's better without the extra lines in the textarea (like it is currently in this PR).

src/keyboard/textinput.js Outdated Show resolved Hide resolved
src/keyboard/textinput.js Outdated Show resolved Hide resolved
src/keyboard/textinput.js Outdated Show resolved Hide resolved
src/keyboard/textinput.js Outdated Show resolved Hide resolved
@akoreman akoreman merged commit bccff5a into ajaxorg:master Jul 24, 2023
4 checks passed
@akoreman akoreman deleted the wider_textinput branch July 24, 2023 11: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.

3 participants