-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Add a default placeholder title for newly added attributes and always show remove button for attributes #35904
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
Conversation
|
@jarekmorawski I think we could improve the default placeholder title. How about "New custom attribute"? |
Test Results SummaryCommit SHA: 681e63c
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
That'd make a good field value, but I think it'd be better to add a meaningful placeholder value that'd be shown in the field before the user starts typing. More like a tooltip than an actual field value entered by default. 🤔
attributes-new.mov |
|
@jarekmorawski the placeholder definitely seems like a good idea and I can add it. I already added the default title that shows up right after a new attribute is added. Do you think it's best to remove it and leave it blank, as it was before? Screen.Recording.2022-12-09.at.09.10.03.mov |
|
Oh, I like that! It's handy to have something in the title, too. Maybe we could change it to |
|
@jarekmorawski Let me investigate that. The PHP + jQuery architecture doesn't help sometimes, but it might be possible |
…pacity class after user types the attribute name at the input
Screen.Recording.2022-12-09.at.10.14.18.movWhat do you think? I managed to do this. As I show in the video, there's just a small quirk in case the user fills in the attribute name, deletes it (blank) and the blur event occurs. In that case, the title is emptied. Do you think it's OK? I think it would rarely occur and the code to handle this would get too complex. |
|
This looks perfectly fine! Thanks for exploring this, @nathanss 🙇 Now the only missing part is the updated Name field placeholder ( |
| <input type="hidden" name="attribute_names[<?php echo esc_attr( $i ); ?>]" value="<?php echo esc_attr( $attribute->get_name() ); ?>" /> | ||
| <?php else : ?> | ||
| <input type="text" class="attribute_name" name="attribute_names[<?php echo esc_attr( $i ); ?>]" value="<?php echo esc_attr( $attribute->get_name() ); ?>" /> | ||
| <input type="text" class="attribute_name" name="attribute_names[<?php echo esc_attr( $i ); ?>]" value="<?php echo esc_attr( $attribute->get_name() ); ?>" placeholder="<?php esc_attr_e( 'New attribute', 'woocommerce' ); ?>" /> |
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.
As far as I understood from this comment, it should say e.g. Fabric or Brand instead of New attribute.
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.
And Custom attribute instead of e.g. Fabric or Brand here.
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.
Great catch @octaedro, I added it to the wrong place. It would look pretty bad if we merged it like this:

LOL!
octaedro
left a comment
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.
Nice job @nathanss! This is testing well on my end and the code LGTM.
I only left a comment related to a placeholder.
I added e.g. Fabric or Brand to the wrong place.
octaedro
left a comment
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.
Thank you @nathanss! LGTM ![]()
… show remove button for attributes (#35904) * Remove CSS that hides the 'Remove' button for product attributes * Add default placeholder title 'Custom attribute' when user adds a new attribute * Add changelog * Add missing esc_html_e * Try to fix PHPCS * Add placeholder value for Attribute name input * Add css and logic to make placeholder title have opacity and remove opacity class after user types the attribute name at the input * Update placeholder value * Fix wrong labels I added e.g. Fabric or Brand to the wrong place.
|
Hello everyone ! |
All Submissions:
Changes proposed in this Pull Request:
Add a default placeholder title for newly added attributes and always show remove button for attributes
Screen.Recording.2022-12-09.at.10.14.18.mov
Closes #35116.
How to test the changes in this Pull Request:
Other information:
pnpm --filter=<project> changelog add?FOR PR REVIEWER ONLY: