RocketCommunicationsInc / astro

Astro UXDS is a collection of guidelines, patterns and components for designing space-based user interface applications.
https://astrouxds.com
Other
115 stars 25 forks source link

fix(select): Options within an opt group now sync to select value when slot changes #1127

Closed micahjones13 closed 1 year ago

micahjones13 commented 1 year ago

Brief Description

When dynamically adding/removing rux-option's from a rux-option-group, the value of the rux-select would not properly sync to a rux-option within the rux-option group. The method to sync these values wasn't being called when a rux-option-group emitted it's changed event.

I left the src/index with an example of the fix in action for convenience of review. Check out the astro-stencil preview to see it. Here's a sandbox version of the bug without the fix as well: https://codesandbox.io/s/misty-moon-0c2nfm?file=/index.html

JIRA Link

https://rocketcom.atlassian.net/browse/ASTRO-6186

Related Issue

https://github.com/RocketCommunicationsInc/astro/issues/1125

General Notes

Added 2 tests for adding/removing rux-option's from a rux-option-group and having the pre-selected value persist.

Motivation and Context

Allows for pre-selected values on rux-select to persist when changes to rux-options within a rux-option-group are made.

Issues and Limitations

Types of changes

Checklist

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: f8fbe736931f127b6d1e8cf63761d35426d46e71

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

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

netlify[bot] commented 1 year ago

Deploy Preview for astro-stencil ready!

Name Link
Latest commit f8fbe736931f127b6d1e8cf63761d35426d46e71
Latest deploy log https://app.netlify.com/sites/astro-stencil/deploys/645402357cb4220008f2f294
Deploy Preview https://deploy-preview-1127--astro-stencil.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] commented 1 year ago

Deploy Preview for astro-preview ready!

Name Link
Latest commit f8fbe736931f127b6d1e8cf63761d35426d46e71
Latest deploy log https://app.netlify.com/sites/astro-preview/deploys/64540235701d6e00089201c7
Deploy Preview https://deploy-preview-1127--astro-preview.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.