Skip to content

Fix ComboBox left/right arrows so they move the input cursor when the menu is open#3415

Merged
LFDanLu merged 1 commit into
mainfrom
combobox_left_right_fix
Aug 19, 2022
Merged

Fix ComboBox left/right arrows so they move the input cursor when the menu is open#3415
LFDanLu merged 1 commit into
mainfrom
combobox_left_right_fix

Conversation

@LFDanLu
Copy link
Copy Markdown
Member

@LFDanLu LFDanLu commented Aug 19, 2022

Closes #3400

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Go to any combobox story and do the following:

  1. Type in something that will open the menu
  2. Attempt to move the cursor left/right via the arrow keys. You should be able to now

🧢 Your Project:

RSP

these are extraneous now since useGridListItem handles the left and right arrows in ListView. Normal lists dont need to handle left and right
Comment on lines -380 to -387
getKeyLeftOf(key: Key): Key {
return key;
}

getKeyRightOf(key: Key): Key {
return key;
}

Copy link
Copy Markdown
Member Author

@LFDanLu LFDanLu Aug 19, 2022

Choose a reason for hiding this comment

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

Unnecessary now that useGridListItem handles left/right arrow keys presses in ListView rather than using useGridCell. Normal lists that use ListLayout won't have elements within their rows so they won't even use useGridCell

Would've written a test but didn't get accurate selectionStart returned by onKeyUp when triggering arrowleft/right (note: userEvent typing properly updated that). A updated version of user test library should fix this theoretically but that will require a greater refactor of our tests so I'll handle that later

@adobe-bot
Copy link
Copy Markdown

Copy link
Copy Markdown
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

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

Works as described in Chrome/Safari/Firefox

@LFDanLu LFDanLu added the small review Easy to review PR label Aug 19, 2022
@LFDanLu LFDanLu changed the title Fix left/right arrows so they move the input cursor when the menu is open Fix ComboBox left/right arrows so they move the input cursor when the menu is open Aug 19, 2022
Copy link
Copy Markdown
Member

@reidbarber reidbarber left a comment

Choose a reason for hiding this comment

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

LGTM

@LFDanLu LFDanLu merged commit e599111 into main Aug 19, 2022
@LFDanLu LFDanLu deleted the combobox_left_right_fix branch August 19, 2022 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

small review Easy to review PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ComboBox: left/right arrow keys do not work after inputing a value while dropdown menu is down

4 participants