Skip to content

Use contentEditable for our hidden accessibility textArea #97154

Open

Description

Investigate into using contenteditable instead of a plain textArea for our hidden accessibility field.
It migh have performance implications, but it would allow us to have richer accessibility content on each line. Including line number, breakpoints etc..

Activity

  1. added
    accessibility
    under-discussion
    on May 7, 2020
  2. LeonarddeR commented on May 7, 2020

    @LeonarddeR

    cc Bram Duvigneau (@bramd) Florian Beijers (@zersiax)

    Note that line number support will probably conflict with the ability of the screen reader to provide line numbers itself. NVDA is able to do this. In Visual Studio, this is also an issue.

  3. zersiax commented on May 7, 2020

    @zersiax

    While that is true, I would say line numbers can be toggled, so I don't necessarily see that as an obstacle for this. If this allows for breakpoint, error and line number indication, I'd say go for at least giving it a test run. The performance implications are one to keep an eye on, though.

  4. derekriemer commented on May 28, 2020

    @derekriemer

    NVDA's line number reading is not going to work in vscode, because vscode can only page n lines at a time to the hidden textarea used for accessibility.

  5. isidorn commented on Jun 26, 2020

    @isidorn
    Author

    Unfortunetly I did not have time to look into this this milestone. In july I am on vacation, thus pushing this out to August.

  6. 1 remaining item

  7. MarcoZehe commented on Feb 22, 2021

    @MarcoZehe
    Contributor

    Isidor Nikolic (@isidorn) since you brought this up in another issue, did you have time at all yet to look into this?

  8. isidorn commented on Feb 22, 2021

    @isidorn
    Author

    Marco Zehe (@MarcoZehe) yeah I found some time, however I hit some bigger issues with this approach. I believe none of them are unsolvable but they showed that this is a bigger effort. So we would use a HTMLDivElement instead of an HTMLTextArea, here are the issues I could not figure out:

    • How to get selection indexes of the HTMLDivElement. It does not have the selectionStart and selectionEnd like the textArea
    • I could not figure out how to set programatically setSelectionRange on an HTMLDivElement
    • Not sure if composition events would work nicely since I noticed that they do not work as expected on google docs. Composition we use when user is inputing Korean for example, or when holding the a to get the ä.

    If somebody has ideas how to tackle these let me know. Especially the first two with selection.

  9. MarcoZehe commented on Feb 22, 2021

    @MarcoZehe
    Contributor

    Does the contentEditable attribute not handle these automatically?

  10. isidorn commented on Feb 22, 2021

    @isidorn
    Author

    Marco Zehe (@MarcoZehe) contentEditable indeed allows for the selection to be changed by the user and it will be automatically updated. However for us the contentEditable is not the truth it is hidden away beneath our editor.
    So when the user changes the selection in our Editor we need to update the selection in the hidden contentEditable. And that is the reason why we have to manipulate the selection programatically.
    Keep in mind that the selection in our editor is not a "real" HTML selection.

    Hopefully I explained this correctly, let me know if not and I can try again :)

  11. yume-chan commented on Feb 23, 2021

    @yume-chan
    Contributor

    For contentEditable elements, the Selection API (https://developer.mozilla.org/en-US/docs/Web/API/Selection) can be used to retrieve and manipulate selection programmatically.

    It is more difficult to use than textarea, because Selection API manages selections on the whole page. Any element without user-select: none can be selected by user and the selection will be returned by Selection API. It may not be a problem in Code, but definitely need attention when Monaco is hosted in users' page.

  12. isidorn commented on Feb 23, 2021

    @isidorn
    Author

    Simon Chan (@yume-chan) that's a good idea, and if I am not mistaken I also tried with that, however I found that API to be much less powerful. Selection.addRange was a bit clunky to use with our model. Another problem was if the editor does not have focus and something is selected in another part of vcscode the underlying editor contentEditable selection should still work - and I am not sure that is the case.
    However I should just try it out again and report here, instead of trying to remember what I did.

  13. LeonarddeR commented on Feb 23, 2021

    @LeonarddeR

    However for us the contentEditable is not the truth it is hidden away beneath our editor.

    Probably a not too smart question, but what is holding you back from implementing something accessible in the true editor?

  14. isidorn commented on Feb 23, 2021

    @isidorn
    Author

    Leonard de Ruijter (@LeonarddeR) it's a good question. Because our true editor is a bunch of html divs, spans and what not. It is not only text, as there can be inline decorations and other details. it is not a textArea or an input field and screen readers do not really work well with our editor HTML structure. Also the cursor is not the real cursor, the selection is not the real html selection and so on.

    I believe Alexandru Dima (@alexdima) the author of the editor considered this and he can probably explain in more detail if needed.

  15. added
    editor-core
    on Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

accessibilityeditor-coreunder-discussion

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions