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

Add clear button for Select #2015

Merged
merged 30 commits into from
May 15, 2024
Merged

Add clear button for Select #2015

merged 30 commits into from
May 15, 2024

Conversation

atmgrifter00
Copy link
Contributor

Pull Request

🤨 Rationale

👩‍💻 Implementation

Essentially just adding a button to the template of the Select that will either set the selectedIndex to the option that represents the placeholder, or to -1 when there is no placeholder option, resulting in empty text for the display.

🧪 Testing

Added unit and Chromatic tests.

✅ Checklist

  • I have updated the project documentation to reflect my changes or determined no changes are needed.

@atmgrifter00 atmgrifter00 requested a review from m-akinc May 8, 2024 18:22
Copy link
Contributor

@m-akinc m-akinc left a comment

Choose a reason for hiding this comment

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

I found it difficult to reason about a lot of the select code (not necessarily the stuff related to this change). Particularly the interplay of value, displayValue, committedSelectedOption, firstSelectedOption, selectedIndex, and the selected attribute of the options. Hopefully my comments still make sense.

packages/nimble-components/src/select/index.ts Outdated Show resolved Hide resolved
packages/nimble-components/src/select/tests/select.spec.ts Outdated Show resolved Hide resolved
packages/nimble-components/src/select/tests/select.spec.ts Outdated Show resolved Hide resolved
packages/nimble-components/src/select/tests/select.spec.ts Outdated Show resolved Hide resolved
@atmgrifter00 atmgrifter00 requested a review from m-akinc May 9, 2024 15:47
@m-akinc m-akinc marked this pull request as ready for review May 9, 2024 17:43
@atmgrifter00 atmgrifter00 marked this pull request as draft May 9, 2024 18:55
@atmgrifter00 atmgrifter00 marked this pull request as ready for review May 9, 2024 20:08
Copy link
Member

@rajsite rajsite left a comment

Choose a reason for hiding this comment

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

Very good, sorry took so long to get to

@atmgrifter00 atmgrifter00 linked an issue May 15, 2024 that may be closed by this pull request
@atmgrifter00 atmgrifter00 enabled auto-merge (squash) May 15, 2024 20:25
@atmgrifter00 atmgrifter00 merged commit f06b18a into main May 15, 2024
10 of 11 checks passed
@atmgrifter00 atmgrifter00 deleted the clear-select branch May 15, 2024 20:49
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.

Ability to clear the selection from nimble-select
4 participants