Skip to content

feat: address-autocomplete supports a default value#120

Merged
jessicamcinchak merged 1 commit intomainfrom
jess/autocomplete-default-value
Mar 22, 2022
Merged

feat: address-autocomplete supports a default value#120
jessicamcinchak merged 1 commit intomainfrom
jess/autocomplete-default-value

Conversation

@jessicamcinchak
Copy link
Copy Markdown
Member

@jessicamcinchak jessicamcinchak commented Mar 22, 2022

ability to set an initialAddress prop on the web component, which is then passed to accessible-autocomplete's defaultValue option: https://github.com/alphagov/accessible-autocomplete.

this will enable us to show the prior selected address when "going back" or "changing" your site address in planx.

in the planx use case, since our initialAddress will only ever be one that was selected prior, we can assume that we already have the full address record stored in the passport/state from a prior event dispatch, and don't need to fire a new one on initial render.

small bonus of improved options sorting in the dropdown - before address "103..." would show up before "47..." etc.

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 22, 2022

✅ Deploy Preview for oslmap ready!

🔨 Explore the source changes: b19e0fe

🔍 Inspect the deploy log: https://app.netlify.com/sites/oslmap/deploys/623a0df78292220008caa920

😎 Browse the preview: https://deploy-preview-120--oslmap.netlify.app/

});

this._options.sort((a, b) => a.localeCompare(b));
const collator = new Intl.Collator([], { numeric: true });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

me too 🙂

@jessicamcinchak jessicamcinchak merged commit 660a92f into main Mar 22, 2022
@jessicamcinchak jessicamcinchak deleted the jess/autocomplete-default-value branch March 22, 2022 18:10
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.

2 participants