-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Decode some characters if used in taxonomy name so it's displayed correctly in Query Loop filters #50376
Conversation
… in Query Loop filters
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @kmanijak! 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirming this PR fixes the issue. Thanks @kmanijak!
One little suggestion is that I think we could use the displayTransform
prop of <FormTokenField />
, this way we only need to pass replaceAmpInTermName
as a prop to the component, instead of having to .map()
the array of suggestions. What do you think @kmanijak?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working great, @kmanijak! Code looks good and it's testing as expected.
However, I would like if somebody else could take a second look before merging. @ajitbohra @ntsekouras @jsnajdr can any of you help with that? 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you!
…rectly in Query Loop filters (#50376) * Decode ampersand if used in taxonomy name so it's displayed correctly in Query Loop filters * Use more generic decoding function and in the displayTransform props of FormTokenField
What?
A couple of characters are not decoded properly and displayed encoded:
&
->&
>
->>
<
-><
This PR solves this problem.
Why?
Users should see decoded values in the frontend.
How?
Values provided to FormTokenField are now decoded using
decodeEntities
. Decoding happens only in presentation layer.Testing Instructions
&
,<
,>
e.g.Sports & Games > winter <
Query Loop
Sports & Games > winter <
is displayed as a suggestion (NotSports & Games > WINTER <
)Sports & Games > winter <
is displayed as a chosen option (NotSports & Games
) and posts are filtered correctlyScreenshots or screencast
Note: Using the
<
and>
characters in the title in this order makes the content disappear. For example:Sports & Games <winter>
becomesSports & Games
but that's not in the scope of this PR.