Skip to content

fix(textfield): icon positioning with field label #2380

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

Merged
merged 15 commits into from
Feb 16, 2024

Conversation

jenndiaz
Copy link
Contributor

@jenndiaz jenndiaz commented Dec 19, 2023

Description

The position of the textfield validation icons currently does not match design spec when the associated feild label wraps or when a side label is applied.

Changes:

  • updated stories for Text Field and Text Area to include controls for including a field label changing the field lable text and toggling between top and side label
  • Add Chromatic coverage for all label options
  • overflow: hidden removes scroll bar from text-area
  • adjust css to position icon correctly

How and where has this been tested?

Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.

Validation steps

In storybook for the text area

  • displayLabel: true, sideLabel: true, and valid: true: the check mark icon is properly positioned
  • displayLabel: true, sideLabel: true, and invalid: true: the alert icon is properly positioned
  • displayLabel: true, sideLabel: false and valid: true: the check mark is properly positioned
  • displayLabel: true, sideLabel: false and invalid: true: the alert icon is properly positioned
  • in both cases, increasing the label text to wrap does not alter icon position
  • increasing text in text area, does not cause a scroll bar to appear

In storybook for the text field

  • displayLabel: true, sideLabel: true, and valid: true: the check mark icon is properly positioned

  • displayLabel: true, sideLabel: true, and invalid: true: the alert icon is properly positioned

  • displayLabel: true, sideLabel: false and valid: true: the check mark is properly positioned

  • displayLabel: true, sideLabel: false and invalid: true: the alert icon is properly positioned

  • in both cases, increasing the label text to wrap does not alter icon position

  • The docs site should not have any changes

  • Chromatic should include kitchen sink approach displaying various label options for text field and text area

Regression testing

Validate:

  1. The documentation pages for at least two other components are still loading, including:
  • The pages render correctly, are accessible, and are responsive.
  1. If components have been modified, VRTs have been run on this branch:
  • VRTs have been run and looked at.
  • Any VRT changes have been accepted (by reviewer and/or PR author), or there are no changes.

Screenshots

Before

Screenshot 2023-12-18 at 1 57 12 PM
Screenshot 2023-12-18 at 1 57 25 PM
Screenshot 2023-12-18 at 1 58 52 PM
Screenshot 2023-12-18 at 1 59 29 PM

After

Screenshot 2023-12-18 at 2 48 24 PM
Screenshot 2023-12-18 at 2 49 04 PM

To-do list

  • I have read the contribution guidelines.
  • I have updated relevant storybook stories and templates.
  • I have tested these changes in Windows High Contrast mode.
  • If my change impacts other components, I have tested to make sure they don't break.
  • If my change impacts documentation, I have updated the documentation accordingly.
  • ✨ This pull request is ready to merge. ✨

Copy link
Contributor

github-actions bot commented Dec 19, 2023

🚀 Deployed on https://pr-2380--spectrum-css.netlify.app

Copy link
Contributor

github-actions bot commented Dec 19, 2023

File metrics

Summary

Total size: 3.93 MB*
Total change (Δ): ⬇ 0.07 KB (-0.00%)
Table reports on changes to a package's main file. Other changes can be found in the collapsed "Details" below.

Package Size Δ
textfield 38.60 KB ⬇ 0.02 KB
Details

textfield

File Head Base Δ
index-base.css 37.66 KB 37.68 KB ⬇ 0.02 KB (-0.06%)
index-theme.css 1.52 KB 1.52 KB -
index-vars.css 38.60 KB 38.62 KB ⬇ 0.02 KB (-0.06%)
index.css 38.60 KB 38.62 KB ⬇ 0.02 KB (-0.06%)
mods.json 2.96 KB 2.96 KB -
themes/express.css 1.05 KB 1.05 KB -
themes/spectrum.css 1.05 KB 1.05 KB -
* Size determined by adding together the size of the main file for all packages in the library.
* Results are not gzipped or minified.
* An ASCII character in UTF-8 is 8 bits or 1 byte.

@jenndiaz jenndiaz added run_vrt For use on PRs looking to kick off VRT and removed run_vrt For use on PRs looking to kick off VRT labels Dec 20, 2023
@jenndiaz jenndiaz marked this pull request as ready for review December 20, 2023 20:49
@jenndiaz jenndiaz changed the title fix(textfield): icon positioning with wrapped fieldlabel fix(textfield): icon positioning with field label Dec 21, 2023
@jenndiaz jenndiaz force-pushed the jenndiaz/css-652-text-field-icon-bug branch from 76f75a7 to c81095c Compare December 22, 2023 22:53
@jenndiaz jenndiaz marked this pull request as draft January 2, 2024 17:12
Copy link
Collaborator

@mdt2 mdt2 left a comment

Choose a reason for hiding this comment

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

Looking great! Just one question in the code.

@@ -443,7 +443,7 @@ governing permissions and limitations under the License.
Sets the opacity to 1 as normalize.css sets an opacity to placeholders
Details: https://github.com/csstools/normalize.css/blob/main/normalize.css#L297
*/
-moz-appearance: textfield;
appearance: textfield;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Curious about the changes to appearance throughout this file, and wondering if we should remove the comments where we've removed prefixes?

Copy link
Contributor Author

@jenndiaz jenndiaz Jan 2, 2024

Choose a reason for hiding this comment

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

this is the stylelint rule that removed these: https://stylelint.io/user-guide/rules/property-no-vendor-prefix/

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if that's what we want 🤔 It looks like the vendor prefixes were added 5+ years ago when the project moved to individual package versions...

It seems like we should either:

  • Thoroughly browser test this PR with the prefixes removed to see if behavior matches prod
  • Or revert the automatic removal of these and create a card in the backlog to explore further

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that it needs closer looking at before they are just removed. I was able to get them back in and added some TODO comments. Writing up a backlog ticket to investigate it further as well.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like the prefixes were reverted again. Maybe try adding --no-verify to your commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oop, they are back now

@jenndiaz jenndiaz marked this pull request as ready for review January 2, 2024 21:56
Copy link
Collaborator

@mdt2 mdt2 left a comment

Choose a reason for hiding this comment

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

Great work, thanks for fixing this!

Copy link
Collaborator

@castastrophe castastrophe left a comment

Choose a reason for hiding this comment

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

Looks great - I noticed the prefixes were stripped again and had a few minor notes on the story format. Thanks!

@castastrophe castastrophe added the run_vrt For use on PRs looking to kick off VRT label Feb 16, 2024
@castastrophe castastrophe force-pushed the jenndiaz/css-652-text-field-icon-bug branch from b3fef3e to 77e60e7 Compare February 16, 2024 17:58
@castastrophe castastrophe merged commit 468b426 into main Feb 16, 2024
@castastrophe castastrophe deleted the jenndiaz/css-652-text-field-icon-bug branch February 16, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-review run_vrt For use on PRs looking to kick off VRT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants