-
Notifications
You must be signed in to change notification settings - Fork 219
Replace DropdownSelector with FormTokenField from Gutenberg #3762
Comments
Instead of creating a new component in Gutenberg, I'm currently taking another approach which consists on extending the |
Now that WordPress/gutenberg#29110 has been merged, I updated the title and description of this issue. We will no longer try to get |
I tried replacing the component and this is what I found while using FormTokenField :
While trying to adapt the Filter Products by Attribute Block, I've come across some issues:
I think the replacement is possible, but we would need make some changes to the Filter Products by Attribute Block logic in order to accommodate the new component. |
This issue has been marked as Internal: After 10 days with no activity this issue will be automatically be closed. |
This issue has been marked as Internal: After 10 days with no activity this issue will be automatically be closed. |
This issue has been marked as Internal: After 10 days with no activity this issue will be automatically be closed. |
This issue has been marked as Internal: After 10 days with no activity this issue will be automatically be closed. |
The goal of this task is to have a component we could also use in other places, like the country dropdown. |
This issue has been marked as Internal: After 10 days with no activity this issue will be automatically be closed. |
This issue has been marked as Internal: After 10 days with no activity this issue will be automatically be closed. |
@Aljullu @ralucaStan I tried to migrate the DropdownSelector to FormTokenField here: We need to load the whole style of the package (adding
@ralucaStan How did you load the style for this component on the frontend? I'm wondering if I'm missing something.
I made a workaround for this issue by comparing the current checked value and the current tokens: woocommerce-blocks/assets/js/blocks/attribute-filter/block.tsx Lines 598 to 608 in d5958b0
The styling is actually possible, but we will have an issue with tokens. In the image below, the token contains Additional issues:
Screen.Recording.2022-06-25.at.16.50.09.mov(Filter button style need some updates) Possible actions
The first one is probably the fastest one if we still want to fix this issue in the current sprint. But I don't think we should do that because we're creating another custom component. From this point of view, it's no different from using |
@dinhtungdu happy to see you picked this up. I still have my branch where I tried this out, I started a PR without saving it for you to see what changes I did 5 months ago, hope this helps. Let me know. Nice workaround with having the lists of added and removed options 👏 |
Gutenberg has a component which is very similar to our
DropdownSelector
:https://github.com/WordPress/gutenberg/tree/trunk/packages/components/src/form-token-field
This issue is about trying to completely remove
DropdownSelector
and instead useFormTokenField
from Gutenberg.In WordPress/gutenberg#29110 some new props were added to that component so it's easier to match the behavior of the
DropdownSelector
.The text was updated successfully, but these errors were encountered: