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

Editor hint in new file can't be reached by tabbing #132085

Open
sana-ajani opened this issue Sep 1, 2021 · 20 comments · May be fixed by #139581 or #219274
Open

Editor hint in new file can't be reached by tabbing #132085

sana-ajani opened this issue Sep 1, 2021 · 20 comments · May be fixed by #139581 or #219274
Assignees
Labels
accessibility Keyboard, mouse, ARIA, vision, screen readers (non-specific) issues bug Issue identified by VS Code Team member as probable bug good first issue Issues identified as good for first-time contributors workbench-untitled-editors Managing of untitled editors in workbench window
Milestone

Comments

@sana-ajani
Copy link
Contributor

sana-ajani commented Sep 1, 2021

Version: 1.60.0-insider
Commit: e7d7e9a
Date: 2021-09-01T10:39:32.559Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 18.7.0

Steps to Reproduce:

Open VS Code and create a new untitled file. Tab over to try to click on the "Select a language" action and the hint disappears. Can we make this action keyboard focus-able?

cc @isidorn

@sana-ajani sana-ajani added the accessibility Keyboard, mouse, ARIA, vision, screen readers (non-specific) issues label Sep 1, 2021
@isidorn
Copy link
Contributor

isidorn commented Sep 2, 2021

Originally I did not make those links clickable because all those actins can be accessed via the command palette, however I do agree that they should be focusable.
Ideally the first tab would focus onto the Select a language and the next on the don't show again.
Or even better the first tab would focus on the whole thing - which would read the whole message, and left right or subsequent tabs would navigate to the links.

@TylerLeonhardt what do you think? Also assigning to you since you now own the untitled hint.

Assigning to September as I think this is minor and we can easily fix.

@isidorn isidorn added this to the September 2021 milestone Sep 2, 2021
@sana-ajani sana-ajani added the good first issue Issues identified as good for first-time contributors label Sep 2, 2021
@san-coding
Copy link

Hey , since it is a good first issue, can I work on this ? , if no, will delete comment, sorry for any inconvenience caused @isidorn

@isidorn
Copy link
Contributor

isidorn commented Sep 6, 2021

@san-coding feel free to provide a PR which tackles this issue. Thank you

@TylerLeonhardt
Copy link
Member

I think this makes sense!

@Leobl
Copy link

Leobl commented Sep 27, 2021

Hey, I could give this a try if that's ok

@TylerLeonhardt
Copy link
Member

Go for it @Leobl!

@Leobl
Copy link

Leobl commented Sep 27, 2021

@TylerLeonhardt may I ask, I would alter cursor style to pointer but is that already done from what I can see here?

@TylerLeonhardt
Copy link
Member

I'm not sure what you mean. This issue is about being able to hit the tab key while in VS Code to highlight the links that show up in the editor so that someone who uses a screen reader can use this feature.

@Leobl
Copy link

Leobl commented Sep 27, 2021

My bad, I misunderstood the request. Thanks for clear that up for me!

@Letiste
Copy link

Letiste commented Nov 14, 2021

Current state
Hello, I tried working on this issue, and as you can see, I can now tab to focus the two links.
But when I activate the link by keyboard (by pressing space or enter), it will write the pressed key.
I implemented the link activation with a listener on the HTML node:

const languageOnKeyPress = async (e: KeyboardEvent) => {
	if (e.code === 'Space' || e.code === 'Enter') {
		e.stopPropagation();
		// Need to focus editor before so current editor becomes active and the command is properly executed
		this.editor.focus();
		await this.commandService.executeCommand(ChangeModeAction.ID, { from: 'hint' });
	} else {
		this.editor.removeContentWidget(this);
	}
	this.editor.focus();
};

How can I prevent the editor to write when I activate the link?

And I don't really know how to test this feature. Should I instantiate a UntitledTextEditorHintContentWidget and trigger the events? If so, how?

Thank you

@Nopec Nopec linked a pull request Dec 21, 2021 that will close this issue
@bpasero bpasero added the workbench-untitled-editors Managing of untitled editors in workbench window label Jan 7, 2022
@meganrogge meganrogge assigned meganrogge and unassigned isidorn Nov 1, 2022
@maigai
Copy link

maigai commented Apr 9, 2023

I've been working on this issue for a bit now. Will send a PR soon!

@isidorn
Copy link
Contributor

isidorn commented Apr 11, 2023

fyi @ulugbekna

@manav014
Copy link

manav014 commented Jun 8, 2024

@isidorn I tried to reproduce this issue, I found that even when workbench.editor.empty.hint is set to text in the below-mentioned VS Code Version, The hint was not visible.

I tried to dig in, for the reason and found that in #213165 we have updated from const shouldRenderDefaultHint = model?.uri.scheme === Schemas.untitled && languageId === PLAINTEXT_LANGUAGE_ID && !inlineChatProviders.length; to const shouldRenderDefaultHint = model?.uri.scheme === Schemas.untitled && languageId === PLAINTEXT_LANGUAGE_ID && hasEditorAgents; and hasEditorAgents is false for the below-mentioned version. (Ref: https://github.com/microsoft/vscode/pull/213165/files#diff-f8e886d59b8516de7fea9105924026f872bf576f42bc20cff450073df79337f7L149).

Is it an expected flow? Would love to fix this if this is not expected.

Version: 1.90.0
Commit: 89de5a8d4d6205e5b11647eb6a74844ca23d2573
Date: 2024-06-04T19:34:48.028Z
Electron: 29.4.0
ElectronBuildId: 9593362
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Darwin arm64 23.5.0

@isidorn
Copy link
Contributor

isidorn commented Jun 10, 2024

Assigning first to @joyceerhl. Feel free to assign back to me if you would like me to investigate.

@joyceerhl
Copy link
Collaborator

@manav014 the issue you describe is fixed in Insiders #214679

@manav014
Copy link

Hey @joyceerhl Thanks for confirming. I can take this forward, would be great if you could assign this to me.

@joyceerhl joyceerhl assigned manav014 and unassigned joyceerhl Jun 20, 2024
@manav014
Copy link

manav014 commented Jun 20, 2024

Thanks for assigning this @joyceerhl !

I tried to work on this.
I've been working on this, and I'm planning to introduce an onKeyDown event. This event will trigger whenever a user presses any key within the editor. If the user presses the Tab key, then user can move across 3 hint operations(select a language, fill with template and don't show ).

However, I haven't found a specific class name that identifies the anchor tags for language selection, template filling, and hiding. To assign a tabIndex and focus these elements on KeyDown, I'd need a class name.
Should I introduce a new class name for these anchor tags?

Alternatively, if this approach seems infeasible, do you have any other ideas on how to achieve this solution?

manav014 added a commit to manav014/vscode that referenced this issue Jun 29, 2024
@manav014 manav014 linked a pull request Jun 29, 2024 that will close this issue
@manav014
Copy link

@joyceerhl I have created a PR that will fix this issue. Would be great if you can review the PR.

@manav014
Copy link

manav014 commented Jul 9, 2024

Hey @joyceerhl did you get a chance to look into this?

manav014 added a commit to manav014/vscode that referenced this issue Jul 11, 2024
manav014 added a commit to manav014/vscode that referenced this issue Jul 13, 2024
manav014 added a commit to manav014/vscode that referenced this issue Jul 29, 2024
manav014 added a commit to manav014/vscode that referenced this issue Jul 31, 2024
manav014 added a commit to manav014/vscode that referenced this issue Jul 31, 2024
@AK281805

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility Keyboard, mouse, ARIA, vision, screen readers (non-specific) issues bug Issue identified by VS Code Team member as probable bug good first issue Issues identified as good for first-time contributors workbench-untitled-editors Managing of untitled editors in workbench window
Projects
None yet