Skip to content

Down arrow moves focus to extensions list#53616

Merged
ramya-rao-a merged 12 commits intomicrosoft:masterfrom
JacksonKearl:a11y/extensions-down-arrow
Jul 19, 2018
Merged

Down arrow moves focus to extensions list#53616
ramya-rao-a merged 12 commits intomicrosoft:masterfrom
JacksonKearl:a11y/extensions-down-arrow

Conversation

@JacksonKearl
Copy link
Contributor

Closes #53185

@JacksonKearl JacksonKearl requested a review from ramya-rao-a July 5, 2018 21:05
@JacksonKearl
Copy link
Contributor Author

@joaomoreno you own the list view right? Should this be a part of all lists or keep it to extensions for now?

@joaomoreno joaomoreno added this to the Backlog milestone Jul 6, 2018
@joaomoreno joaomoreno added the list-widget List widget issues label Jul 6, 2018
this.onDidFocus = mapEvent(domEvent(this.view.domNode, 'focus', true), () => null);
this.onDidBlur = mapEvent(domEvent(this.view.domNode, 'blur', true), () => null);

this.onDidFocus(() => this.focusFirstItemIfNothingFocused(), this, this.disposables);
Copy link
Member

Choose a reason for hiding this comment

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

I really don't think this is the best behaviour for the list. The default behaviour of DOM focus should be just that, not focusing an element.


focus(): void {
super.focus();
this.list.domFocus();

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

This comment was marked as resolved.

@JacksonKearl JacksonKearl changed the title Down arrow focuses list view. Tab and down arrow focus first element in list view Jul 6, 2018
@JacksonKearl
Copy link
Contributor Author

JacksonKearl commented Jul 10, 2018

@joaomoreno I'd prefer to keep the implementation for List's as is, as we tend to visibly hilight the focused element even when the parent List is not focused, which begins to be noisy. What do you think?

@joaomoreno
Copy link
Member

Oh... that seems inconsistent. IMO a focused element in an inactive tree/list should not have a background... But now we have this: #46129 ... it's a pickle.

I propose to set list.inactiveFocusForeground to transparent on our base themes. Other themes may set that color.


I would not keep this implementation simply because it is an accessibility issue that a widget's state changes when it gets DOM focus. The state (that the first element is focused) should have been there all along.

@JacksonKearl JacksonKearl force-pushed the a11y/extensions-down-arrow branch 2 times, most recently from 4f94847 to 80a8e08 Compare July 12, 2018 18:38
@JacksonKearl JacksonKearl force-pushed the a11y/extensions-down-arrow branch from 80a8e08 to 654e4e2 Compare July 12, 2018 18:44
@JacksonKearl
Copy link
Contributor Author

@joaomoreno I changed all the lists from an onFocus implementation to an onContentChange one, but I'm not really happy about the change, as I'm finding it difficult to do this in a way that generalizes at all. Given there is no onContentChange type property of the List that I know of, each different instance requires a bespoke solution, relying on underlying features of each particular model (some models have onChange style events, others (such as IPagedModel) do not).

Also, it will be impossible to generalize this to extension provided list viewlets, as it requires knowledge of the model being used. Do you still think this is the best way forward? And is there a generalized content change event somewhere on either lists or trees that I'm not seeing?

@JacksonKearl
Copy link
Contributor Author

JacksonKearl commented Jul 13, 2018

This now only addresses the original issue of navigating to the extensions list view on down arrow, in response to #53755 (comment)

@JacksonKearl JacksonKearl changed the title Tab and down arrow focus first element in list view Down arrow moves focus to extensions list Jul 16, 2018
@JacksonKearl
Copy link
Contributor Author

@ramya-rao-a this is entirely confined to the extensions viewlet now, if you want to take a look. We can update everything later, pending a decision on #53755 (comment)

this.list.model = model;
this.list.scrollTop = 0;
const count = this.count();
this.list.focusNext();
Copy link
Contributor

Choose a reason for hiding this comment

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

this makes more sense inside the new focus

export const listInactiveSelectionBackground = registerColor('list.inactiveSelectionBackground', { dark: '#3F3F46', light: '#CCCEDB', hc: null }, nls.localize('listInactiveSelectionBackground', "List/Tree background color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not."));
export const listInactiveSelectionForeground = registerColor('list.inactiveSelectionForeground', { dark: null, light: null, hc: null }, nls.localize('listInactiveSelectionForeground', "List/Tree foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not."));
export const listInactiveFocusBackground = registerColor('list.inactiveFocusBackground', { dark: '#313135', light: '#d8dae6', hc: null }, nls.localize('listInactiveSelectionBackground', "List/Tree background color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not."));
export const listInactiveFocusBackground = registerColor('list.inactiveFocusBackground', { dark: null, light: null, hc: null }, nls.localize('listInactiveFocusBackground', "List/Tree background color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not."));
Copy link
Contributor

Choose a reason for hiding this comment

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

not needed anymore?

@ramya-rao-a ramya-rao-a merged commit 7db5f96 into microsoft:master Jul 19, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

list-widget List widget issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ctrl/Cmd+Down arrow from extension search box should focus extension list

3 participants