Skip to content

Fix autocomplete keyboard nav in link popover#10716

Merged
gziolo merged 3 commits intomasterfrom
fix/autocomplete-keyboard-nav-in-link
Oct 18, 2018
Merged

Fix autocomplete keyboard nav in link popover#10716
gziolo merged 3 commits intomasterfrom
fix/autocomplete-keyboard-nav-in-link

Conversation

@talldan
Copy link
Copy Markdown
Contributor

@talldan talldan commented Oct 18, 2018

Description

Fixes #10689

Resolves a regression caused by #10500:

How has this been tested?

  • Manual Testing
  • e2e tests added for both issues

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@talldan talldan self-assigned this Oct 18, 2018
@talldan talldan requested a review from noisysocks October 18, 2018 05:08
@talldan talldan added the [Type] Bug An existing feature does not function as intended label Oct 18, 2018
@talldan talldan changed the title Fix/autocomplete keyboard nav in link Fix autocomplete keyboard nav in link popover Oct 18, 2018
@talldan talldan added this to the 4.1 - UI freeze milestone Oct 18, 2018
Copy link
Copy Markdown
Member

@noisysocks noisysocks left a comment

Choose a reason for hiding this comment

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

Thanks for staying on top of this and for getting a fix up so fast! 🙌

This fixes the bug for me locally and I'm not seeing any regressions. Glad that our war chest of link E2E tests is getting a little bit bigger with each passing day.

One thing I just noticed is that there's an inconsistency between using the keyboard and using the mouse. When you use the keyboard, the link is immediately inserted and you are no longer in link edit mode. When you use the mouse, the URL is inserted but you remain in link edit mode.

Would be good to address that, but I don't think it's a blocker.

if ( showSuggestions && selectedSuggestion !== null && ! this.scrollingIntoView ) {
this.scrollingIntoView = true;
scrollIntoView( this.suggestionNodes[ selectedSuggestion ], this.autocompleteRef, {
scrollIntoView( this.suggestionNodes[ selectedSuggestion ], this.autocompleteRef.current, {
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.

Doh! 🤦‍♂️

@gziolo gziolo merged commit 86605e4 into master Oct 18, 2018
@gziolo gziolo deleted the fix/autocomplete-keyboard-nav-in-link branch October 18, 2018 08:13
@gziolo
Copy link
Copy Markdown
Member

gziolo commented Oct 18, 2018

Let's get it in as it's better than what we had before. We have whole RC cycle to improve it :)

@mtias mtias added the [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). label Oct 18, 2018
antpb pushed a commit to antpb/gutenberg that referenced this pull request Oct 26, 2018
* Fix autocomplete cursor key navigation

* Avoid running onClickOutside logic for other non-onClickOutside events

* Add e2e tests for keyboard interaction with link container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Insert Link: up/down arrow in link autocomplete crashes block

4 participants