xtermjs / xterm.js

A terminal for the web
https://xtermjs.org/
MIT License
17.43k stars 1.62k forks source link

Copy&paste with screenReaderMode #1931

Open marusak opened 5 years ago

marusak commented 5 years ago

When screenReaderMode is used it is not possible to use right-click and select copy or paste from context menu.

Details

Steps to reproduce

  1. var term = new Term({ screenReaderMode: true });

  2. Then right-click on the terminal and there is no option for pasting.

Almost related question: This property can be set only in constructor, right? It is not possible to dynamically change between modes?

Tyriar commented 5 years ago

You should be able to switch between modes at runtime:

https://github.com/xtermjs/xterm.js/blob/8ea254bdc798ffcf72cb1b37385af40c747d3fa4/src/Terminal.ts#L489-L499

flenter commented 4 years ago

I experimented a bit with adding pointer-events: none; to the .xterm-accessibility element. This seems to restore the copy/paste functionality while maintaining the screenreader functionality (this last thing was tested with voiceover on mac in conbimation with Chrome). Would there be a disadvantage to this approach?

Tyriar commented 4 years ago

@flenter as long as screen readers work fine and hover to announce works as well then that sounds good.

shanytc commented 3 years ago

the main issue for right click -> Save Image.. context-menu in xtermjs, is because '.xterm-helpers' is having position:absolute. Try change it to position: relative. When you right click on the canvas, xtermjs will calculate the x,y position of the mouse and move the