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

SelectionList: Option should scroll into view when focused with the keyboard #1727

Closed
2 tasks
benjamincharity opened this issue Oct 1, 2019 · 0 comments · Fixed by #1731
Closed
2 tasks
Assignees
Labels
Focus: component Issues concerning a specific component Target: latest Issues related to the latest version of the library (master) Type: bug An implemented item with undesired effects

Comments

@benjamincharity
Copy link
Contributor

Currently, if the user uses the arrow keys to move down the list of options, they can move their selection out of view:

Kapture 2019-10-01 at 10.38.34.gif

The focused option should scroll into view as the user moves down the list.

See

private scrollToOption(): void {
const index: number = this.autocompletePanel.keyManager.activeItemIndex || 0;
const labelCount: number = countGroupLabelsBeforeOption(index, this.autocompletePanel.options, this.autocompletePanel.optionGroups);
const newScrollPosition = getOptionScrollPosition(
index + labelCount,
// FIXME: can this height be dynamic like the TsSelectComponent? https://github.com/GetTerminus/terminus-ui/issues/1153
AUTOCOMPLETE_OPTION_HEIGHT,
this.autocompletePanel.getScrollTop(),
AUTOCOMPLETE_PANEL_HEIGHT,
);
this.autocompletePanel.setScrollTop(newScrollPosition);
}


  • Add functionality to scroll focused option into view
  • Add test
@benjamincharity benjamincharity added Focus: component Issues concerning a specific component Target: latest Issues related to the latest version of the library (master) Type: feature Functionality that doesn't currently exist Type: bug An implemented item with undesired effects and removed Type: feature Functionality that doesn't currently exist labels Oct 1, 2019
@benjamincharity benjamincharity self-assigned this Oct 1, 2019
benjamincharity added a commit that referenced this issue Oct 2, 2019

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
ISSUES CLOSED: #1727
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Focus: component Issues concerning a specific component Target: latest Issues related to the latest version of the library (master) Type: bug An implemented item with undesired effects
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant