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

ComboboxControl: Normalize hyphen-like unicode characters to ASCII hyphens when matching search queries #42942

Merged
merged 3 commits into from
Aug 15, 2022

Conversation

markbiek
Copy link
Contributor

@markbiek markbiek commented Aug 3, 2022

What?

When searching, treat hyphen-like characters as an ASCII hyphen (%2D).

Why?

This is the implementation agreed upon in discussions on #41952. This improves the search but doesn't affect search result highlighting or cause any other accessibility regressions.

How?

Following the example outlined by @ciampo , we have a list of hyphen-like characters that are replaced with an ASCII - when looking for search matches.

Testing Instructions

Run

npm run test:unit ./packages/components/src/utils/test/strings.js

to verify string normalization is functioning properly.

Screenshots or screencast

image

image

@github-actions
Copy link

github-actions bot commented Aug 3, 2022

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @markbiek! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Aug 3, 2022
@mirka mirka requested review from mirka and ciampo August 5, 2022 13:24
@mirka mirka added this to In progress (owned) ⏳ in WordPress Components via automation Aug 5, 2022
@mirka mirka added [Type] Enhancement A suggestion for improvement. [Package] Components /packages/components labels Aug 5, 2022
Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

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

Thank you, this is working very nicely!

I just had some stylistic thoughts, but feature-wise I think this is good to go 👍 If you could also add a quick changelog, that'd be great.

packages/components/src/combobox-control/index.js Outdated Show resolved Hide resolved
packages/components/src/combobox-control/stories/index.js Outdated Show resolved Hide resolved
@ciampo ciampo changed the title Normalize hyphen-like unicode characters to ASCII hyphens ComboboxControl: Normalize hyphen-like unicode characters to ASCII hyphens when matching search queries Aug 11, 2022
@ciampo ciampo moved this from In progress (owned) ⏳ to In progress ⏳ (un-owned) in WordPress Components Aug 11, 2022
@markbiek markbiek force-pushed the improvement/normalize-hyphens branch 2 times, most recently from 34e17a9 to 26a919d Compare August 11, 2022 14:51
This removes accents, sets to locale-specific lowercase, and replaced hyphen-like unicode characters with an ASCII hyphen
@markbiek markbiek force-pushed the improvement/normalize-hyphens branch from 26a919d to f26e37d Compare August 11, 2022 15:54
Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

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

Looking good! Thank you so much for this solid improvement 🚀

packages/components/CHANGELOG.md Outdated Show resolved Hide resolved
WordPress Components automation moved this from In progress ⏳ (un-owned) to In progress (owned) ⏳ Aug 15, 2022
@mirka mirka merged commit da671a3 into WordPress:trunk Aug 15, 2022
WordPress Components automation moved this from In progress (owned) ⏳ to Done 🎉 Aug 15, 2022
@github-actions
Copy link

Congratulations on your first merged pull request, @markbiek! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 14.0 milestone Aug 15, 2022
@markbiek markbiek deleted the improvement/normalize-hyphens branch August 18, 2022 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants