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

[Feat] Improve QSelect #1186

Closed

Conversation

alexdee2007
Copy link
Contributor

@alexdee2007 alexdee2007 commented Nov 26, 2017

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Some explanation of this proposed feature

When focused on select field (by press key "Tab" on previous field eg) then press key "Enter" will be show popover with list options. If there is a filter then it will be focused (assumed that user uses keyboard and dont want mouse click). Keyboard navigation when filter focused also available.

When popover with list options showing - if there is selected item(s) (field value) then viewport will scroll first encountered option in the middle viewport.
And there is available navigation:

Press key "Up" or "Down"

  • navigate by list options. Viewport will scroll automatically.

Pres key "Enter" on option:

  • when select has multiple values - will be toggle value
  • when select has one value - this value will be selected, popover hide and this select field will be focused so user can "Tab" to the next field or reopen this

Press key "Esc":

  • popover hide and select field will be focused so user can "Tab" to next field or reopen this popover

Press key "Tab":

  • popover hide and focus go to the next field (ordering by tabindex or by position in dom)

Press keys "Shift+Tab":

  • popover hide and focus go to the previuos field (ordering by tabindex or by position in dom)

When user inputs a filter then first option suggest to be "enter" (only on desktop platform)

Additional info:

  • Add props list-max-height to select component (maxHeight popover nevertheless has 100vh so list options in any case will be within the screen area)
  • Fix toggle show/hide popover when click on field
  • Remove props autofocus-filter. Filter will be focus on desktop platform automatically
  • Fix twice emitting blur and focus
  • Dropdown icon rotate when open/hide popover
  • Smooth popover reposition (popover jumps around the screen when input filter and popover located at the top of the field )
  • Fix lose focus when click on chips and clear
  • Add props autoOpen, loading, loadingLabel, noResultsLabel, noDataLabel and implements
  • Mouse and keyboard have same selection
  • Add selects labels loadingLabel, noResultsLabel, noDataLabel to i18n
  • Allow prop multiple set limit
  • Add prop limit to QOptionGroup

close #903

alexdee2007 added 2 commits November 26, 2017 19:05
* Add props scroll-height to select component 
* Function prevent is placed in a separate module 
* Fix in Autocomplete component (addEventListener on 'keydown')
@alexdee2007 alexdee2007 changed the title Feature: Add keyboard navigate to select component Feature: Add keyboard navigate to select component #761 Nov 26, 2017
@alexdee2007 alexdee2007 changed the title Feature: Add keyboard navigate to select component #761 Feature: Add keyboard navigate to select component (#761) Nov 26, 2017
@alexdee2007
Copy link
Contributor Author

alexdee2007 commented Nov 26, 2017

case 40: // down
this.__moveCursor(1, e)
break
case 13: // enter
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please also add SPACE as selection toggle

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add, thanks )

Copy link
Contributor Author

@alexdee2007 alexdee2007 Nov 27, 2017

Choose a reason for hiding this comment

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

Hmm... Adding SPACE handler will make it impossible to enter a space in the filter. I revert this change. Let's wait for @rstoenescu

@@ -170,7 +178,11 @@ export default {
autofocusFilter: Boolean,
radio: Boolean,
placeholder: String,
separator: Boolean
separator: Boolean,
scrollHeight: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use a more appropriate name like listMaxHeight and use an empty default

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, thanks! listMaxHeight will be more appropriate.
I`m not sure about empty default. E.g. IE do not recognized scroll on viewport without setting "heigh" or "max-heigt" property...

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's wait for Razvan's opinion on this also. (@rstoenescu)

@alexdee2007 alexdee2007 closed this Dec 1, 2017
@alexdee2007 alexdee2007 deleted the select-keyboard-navigate branch December 1, 2017 11:26
@alexdee2007 alexdee2007 reopened this Dec 2, 2017
@alexdee2007 alexdee2007 changed the title [Featue] Improve QSelect [WIP] Improve QSelect Dec 15, 2017
@alexdee2007 alexdee2007 changed the title [WIP] Improve QSelect [Feat] Improve QSelect Dec 16, 2017
@wc-matteo
Copy link
Contributor

These improvements would be really nice! Let's hope they get merged soon!

wink wink nudge nudge

@rstoenescu rstoenescu added this to the v0.17.0 milestone Jul 27, 2018
@rstoenescu rstoenescu closed this Jul 27, 2018
@dietrichg
Copy link

Can we also have an option to filter if the user starts typing and the QSelect is focused?
Much how the native select works where you can type to select available options in the list without having to drill into it. This helps for data-entry focused people who are familiar with the available options already

@alexdee2007
Copy link
Contributor Author

Can we also have an option to filter if the user starts typing and the QSelect is focused?
Much how the native select works where you can type to select available options in the list without having to drill into it. This helps for data-entry focused people who are familiar with the available options already

As far as i know it will be available in v1

@smolinari
Copy link
Collaborator

It is!

Scott

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request] QSelect add key events
7 participants