+
Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Conversation

clintcs
Copy link
Collaborator

@clintcs clintcs commented May 28, 2024

🚀 Description

Textarea

  • Migrates it to Label.
  • Description and character count are now read by screenreaders.
  • Adds spellcheck and autocapitalize attributes.
  • Adds a gap between the description and character count for long descriptions.
  • Renames label-position to orientation to bring it in line with Label and the other components.
  • Removes various test associated with the existence of an "error" class. The bulk of this logic is now handled by Label.
  • Boldens the character count when exceeded.

Input

  • Only bolden the character count when it's invalid. Not when Input is invalid for other reasons.

Label

  • Adds support for part::tooltip-and-label-container for Textarea's vertically aligned label and tooltip.

📋 Checklist

  • I have read and followed the Contributing Guidelines.
  • I have added tests to cover new or updated functionality.
  • I have created or updated stories in Storybook to document the new functionality.
  • I have included a changeset with this Pull Request if it adds/updates/removes functionality for consumers.
  • I have scheduled a Design Review for these changes, if one is required.
  • I have followed the ARIA Authoring Practices Guide and/or met with the Accessibility Team to ensure this functionality is accessible.

🔬 How to Test

  • Textarea's looks like production except for spacing changes.
  • Textarea's description is announced by VoiceOver.
  • Textarea's label is announced by VoiceOver even when hidden.
  • Input's character count is only bold when the max count is exceeded.

We're planning to cut a release after this. I'd appreciate a second set of eyes on both components 🙏.

Known Issues

I found a few bugs while doing the migration that you may come across while testing. I'll create a ticket:

  • Input isn't invalid when its character count is exceeded.
  • Input and Textarea continue to show error feedback when required is removed programatically.
  • Input still shows error feedback when a single character is entered.

📸 Images/Videos of Functionality

N/A

Copy link

changeset-bot bot commented May 28, 2024

🦋 Changeset detected

Latest commit: b25e585

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@crowdstrike/glide-core-components Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

@clintcs clintcs force-pushed the migrate-textarea-to-label branch from ab5a931 to 1c59fe2 Compare May 28, 2024 15:21
.control {
display: block;
&.error {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This won't work in this case because the <textarea> has a container. Input and Textarea are back to coloring their own borders.

'tooltip-and-label': true,
hidden: this.hide,
})}
part="tooltip-and-label-container"
Copy link
Collaborator Author

@clintcs clintcs May 28, 2024

Choose a reason for hiding this comment

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

We don't have much of a use for parts externally because we don't consumers to arbitrarily style components. But Label is private. This allows Textarea's one-off, vertically aligned label-and-tooltip to exist without Label explicitly accommodating it.

expect(element).to.have.attribute('rows', '2');

expect(textarea).to.exist;
expect(textarea?.textContent).to.equal('value');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Lit doesn't support expressions inside <textarea>.

image

expect(label?.textContent?.trim()).to.be.equal('label');
});

it('renders a visually hidden label when attribute `hide-label` is set', async () => {
Copy link
Collaborator Author

@clintcs clintcs May 28, 2024

Choose a reason for hiding this comment

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

All now the responsibility of Label.

})}
?disabled=${this.disabled}
aria-describedby="description"
aria-describedby="meta"
Copy link
Collaborator Author

@clintcs clintcs May 28, 2024

Choose a reason for hiding this comment

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

Renamed to match Input.

Copy link
Collaborator Author

@clintcs clintcs May 28, 2024

Choose a reason for hiding this comment

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

Got rid of the <div class="component" data-test="component"> wrapper.

}
.character-count {
font-weight: var(--cs-font-weight-bold);
Copy link
Collaborator Author

@clintcs clintcs May 28, 2024

Choose a reason for hiding this comment

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

The character count should only be bold when the count is invalid, not when Textarea is invalid for other reasons. I moved this below where it's only applied then. I moved the .input-box border coloring closer to .input-box for consistency.

display: flex;
gap: var(--cs-spacing-xxs);
line-height: var(--cs-body-xs-line-height);
overflow: hidden;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unused?

@state()
private isReportValidityOrSubmit = false;

#componentElementRef = createRef<HTMLDivElement>();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unused.

@clintcs clintcs marked this pull request as ready for review May 28, 2024 18:41
Copy link
Collaborator

@ynotdraw ynotdraw left a comment

Choose a reason for hiding this comment

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

One thing I noticed is that when hide-label is added, the textarea no longer takes up 100% of the width when comparing with /main. Is that intentional? Looks like the same thing on Input as well.

Before After
Screenshot 2024-05-28 at 3 51 25 PM Screenshot 2024-05-28 at 3 51 01 PM

@clintcs
Copy link
Collaborator Author

clintcs commented May 28, 2024

One thing I noticed is that when hide-label is added, the textarea no longer takes up 100% of the width when comparing with /main. Is that intentional? Looks like the same thing on Input as well.

Great catch! I pushed a fix.

@clintcs clintcs merged commit 73cc661 into main May 28, 2024
@clintcs clintcs deleted the migrate-textarea-to-label branch May 28, 2024 21:07
@github-actions github-actions bot mentioned this pull request May 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载