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

Ensure pressing 'Enter' in SelectPanel filter input causes navigation if first item is link #2978

Merged
merged 23 commits into from
Aug 6, 2024

Conversation

camertron
Copy link
Contributor

@camertron camertron commented Jul 29, 2024

Authors: Please fill out this form carefully and completely.

Reviewers: By approving this Pull Request you are approving the code change, as well as its deployment and mitigation plans.
Please read this description carefully. If you feel there is anything unclear or missing, please ask for updates.

What are you trying to accomplish?

In a previous PR, I added functionality to ensure that pressing Enter while focused on the filter input of a SelectPanel selects the first list item, in accordance with our API docs for the component. However, the methodology I chose did not account for the case when list items are links, i.e. anchor elements. This PR simulates a click event instead, so everything works as expected even when list items are links.

Screenshots

The video below shows that pressing Enter while focused on the filter input navigates to the URL specified in the anchor tag for the first list item, which is https://github.com.

selectpanel_enter.mov

Integration

No changes necessary in production.

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

Accessibility

  • No new axe scan violation - This change does not introduce any new axe scan violations.

Merge checklist

  • Added/updated tests
    - [ ] Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

Copy link

changeset-bot bot commented Jul 29, 2024

🦋 Changeset detected

Latest commit: cc1b9c0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/view-components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Jul 29, 2024

⚠️ Visual differences found

Our visual comparison tests found UI differences. Please review the differences by viewing the files changed tab to ensure that the changes were intentional.

Review visual differences

@camertron camertron marked this pull request as ready for review July 29, 2024 17:40
@camertron camertron requested review from a team as code owners July 29, 2024 17:40
@kendallgassner
Copy link
Contributor

I tested in Lookbook and discovered a niche bug. In the single select playground example, if you select an item via the input, then filter the input by some text and select a different item, both items are selected when you reopen the panel.

@kendallgassner
Copy link
Contributor

kendallgassner commented Jul 30, 2024

Still seeing the same issue:

CleanShot.2024-07-30.at.16.07.32.mp4

Alt: On storybook SelectPanel/playground I navigate to an item using the search field. I check that item. When I reopen the SelectPanel two items are selected even though I am in a SingleSelect.

@camertron
Copy link
Contributor Author

Alright, we ended up removing the piggybacking code designed to fix issues where a user's selections would be overridden by server-rendered selections. This PR now only contains fixes for the issue in the title + description.

@camertron camertron merged commit fac1ec9 into main Aug 6, 2024
37 checks passed
@camertron camertron deleted the select_panel_enter_should_navigate branch August 6, 2024 18:14
@primer primer bot mentioned this pull request Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants