Skip to content

list.clear should clear both focus and selection in one go#78709

Merged
isidorn merged 3 commits intomasterfrom
isidorn/listClear
Aug 9, 2019
Merged

list.clear should clear both focus and selection in one go#78709
isidorn merged 3 commits intomasterfrom
isidorn/listClear

Conversation

@isidorn
Copy link
Copy Markdown
Collaborator

@isidorn isidorn commented Aug 8, 2019

Currently if you have a tree which is both selected and focused it takes two times to press esc to first clear the focus and then the selection.
This makes it harder for users to navigate up to the tree via focus. This affects accessibility and #1043 for example.

This PR changes this behavior that esc always clears both selection and focus.

list.setSelection([]);
} else if (list.getFocus().length > 0) {
}
if (list.getFocus().length > 0) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why this check?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It was already there and I just did not remove it.
I guess all those checks do not really make sense now and should be removed.
We should just setSelection([]) and setFocus([])

@joaomoreno joaomoreno added this to the August 2019 milestone Aug 8, 2019
@joaomoreno joaomoreno assigned isidorn and unassigned joaomoreno Aug 8, 2019
@joaomoreno joaomoreno added accessibility Keyboard, mouse, ARIA, vision, screen readers (non-specific) issues list-widget List widget issues tree-widget Tree widget issues labels Aug 8, 2019
@isidorn
Copy link
Copy Markdown
Collaborator Author

isidorn commented Aug 8, 2019

I pushed a simplified approach to this.
Also unrelated issue: esc does not clear the focus when in the extensions view.
It seems that both WorkbenchListFocusContextKey, WorkbenchListHasSelectionOrFocus are false when Extensions list has focus which is weird.

@isidorn isidorn merged commit 1f931a6 into master Aug 9, 2019
@isidorn isidorn deleted the isidorn/listClear branch August 9, 2019 07:44
@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

accessibility Keyboard, mouse, ARIA, vision, screen readers (non-specific) issues list-widget List widget issues tree-widget Tree widget issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants