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

Combobox with grid popup: Make escape key behavior consistent with pattern #1334

Merged
merged 6 commits into from
Mar 17, 2020

Conversation

mcking65
Copy link
Contributor

@mcking65 mcking65 commented Feb 16, 2020

Fix issue #1066 for the grid combobox.

  • Update keyboard documentation to reflect expected behavior
  • Change JavaScript so Escape functions as documented
  • Revise tests to test documented behavior

Preview Link

View the combobox with grid popup in compare branch of this PR

Review checklist

Copy link
Contributor

@carmacleod carmacleod left a comment

Choose a reason for hiding this comment

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

+1 for Editorial review.

@jongund jongund self-requested a review February 19, 2020 20:03
@jongund
Copy link
Contributor

jongund commented Feb 19, 2020

@mcking65

I have updated the escape key behavior and escape key regression tests to match the pattern.

@mcking65 mcking65 marked this pull request as ready for review February 25, 2020 19:33
@mcking65 mcking65 requested a review from zcorpan February 28, 2020 08:01
@mcking65 mcking65 linked an issue Feb 28, 2020 that may be closed by this pull request
5 tasks
Copy link
Contributor Author

@mcking65 mcking65 left a comment

Choose a reason for hiding this comment

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

When visual focus is in the grid, pressing escape does not hide the grid and change the combobox state to collapsed. It only moves visual focus back to the input. It is supposed to do both. Example:

  1. Focus combobox
  2. Type 'A'
  3. Press down arrow to move visual focus into the grid.
  4. Press escape.

Expected:

  1. Visual focus moves back to input.
  2. Grid is closed.

Actual: focus moves back to input.

This indicates the tests are also not testing correctly, otherwise the test for escape in the grid would fail.

@carmacleod carmacleod self-requested a review February 28, 2020 13:31
@zcorpan zcorpan self-assigned this Mar 6, 2020
@zcorpan
Copy link
Member

zcorpan commented Mar 6, 2020

I've fixed the logic so that escape always hides the popup if the popup is visible, regardless of focus.

We were testing this case correctly. It's just that the test was marked as expected to fail, since this was a known issue: #860

I've changed the test so it instead expects to pass, and it does.

@zcorpan zcorpan requested a review from spectranaut March 6, 2020 14:12
@zcorpan
Copy link
Member

zcorpan commented Mar 6, 2020

@spectranaut can you review my changes?

@zcorpan
Copy link
Member

zcorpan commented Mar 6, 2020

Looks like we're missing some tests. But that was the case before this PR, too, so I've filed an issue to track this: #1349

@@ -94,12 +94,16 @@ aria.GridCombobox.prototype.handleInputKeyDown = function (evt) {
);
}
else {
if (!this.shown) {
setTimeout((function () {
// On Firefox, input does not get cleared here unless wrapped in
Copy link
Member

Choose a reason for hiding this comment

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

Do we know why this happens? Is it a bug in Firefox?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is an issue of using keydown, instead of the keyup event. I was only asked to fix the ESC behavior, so I didn't think it would be good to make more changes than requested.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @jongund, that's good call. let's address that as a separate issue if there is a better way to resolve it than what is currently implemented.

Copy link
Member

@zcorpan zcorpan left a comment

Choose a reason for hiding this comment

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

code review and test review done.

Copy link
Contributor Author

@mcking65 mcking65 left a comment

Choose a reason for hiding this comment

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

Functionally now working as documented.

@mcking65
Copy link
Contributor Author

mcking65 commented Mar 9, 2020

OK, now just waiting on a review by @spectranaut of the test changes made by @zcorpan. I will merge if @spectranaut approves.

@carmacleod
Copy link
Contributor

carmacleod commented Mar 9, 2020

Should down arrow (and/or alt+down arrow) open the grid? (It currently doesn't, but I think it should).
It currently feels strange that you have to type an appropriate letter key to open the grid.
(If this comment would be better as a new issue, please let me know).

@mcking65
Copy link
Contributor Author

mcking65 commented Mar 9, 2020

@carmacleod commented:

Should down arrow (and/or alt+down arrow) open the grid? (It currently doesn't, but I think it should).
It currently feels strange that you have to type an appropriate letter key to open the grid.
(If this comment would be better as a new issue, please let me know).

That is issue #1266.

@carmacleod
Copy link
Contributor

@mcking65

That is issue #1266.

Ah, right. Sorry about that. :) Thanks!

Copy link
Contributor

@carmacleod carmacleod left a comment

Choose a reason for hiding this comment

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

+1 again, for the latest.

@mcking65 mcking65 linked an issue Mar 17, 2020 that may be closed by this pull request
5 tasks
@mcking65 mcking65 merged commit aabf040 into master Mar 17, 2020
@mcking65 mcking65 deleted the issue1066-for-grid branch March 17, 2020 06:40
michael-n-cooper pushed a commit that referenced this pull request Mar 17, 2020
Combobox with grid popup: Make escape key behavior consistent with pattern (pull #1334)

Fixes #860 and #1066:
* Revise Escape key documentation to reflect expected behavior
* updated escape key behavior to match combobox pattern
* Make escape hide the popup if it's shown, regardless of where focus is
* Update the corresponding test to no longer expect a failure (fixes #860).
* Remove comment about failing test

Co-authored-by: Jon <[email protected]>
Co-authored-by: Simon Pieters <[email protected]>
carmacleod pushed a commit to carmacleod/aria-practices that referenced this pull request Mar 31, 2020
…ttern (pull w3c#1334)

Fixes w3c#860 and w3c#1066:
* Revise Escape key documentation to reflect expected behavior
* updated escape key behavior to match combobox pattern
* Make escape hide the popup if it's shown, regardless of where focus is
* Update the corresponding test to no longer expect a failure (fixes w3c#860).
* Remove comment about failing test

Co-authored-by: Jon <[email protected]>
Co-authored-by: Simon Pieters <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants